Page 1 of 1
Exporting / extracting only played hands out of a mining db

Posted:
Tue Jan 13, 2009 12:29 pm
by TroyMcLure
Hi,
i accidentally imported some played hands into one of my mining dbs while playing (because i didn't switch to my played hands db as "active db" before playing). Is there a way to export or extract these hands so that i can import them into my played hands db (and delete them from my mining db)?
As a workaround i could purge all mined hands out of the db, export the db, import the exported files into my played hands db and then reimport the mined hands (i still have all hands files). But this seems to take a lot of time and a little "overdosed" as i have more than 1,5 billion mined hands in this db and only need to extract 5k played hands.
If this is not possible in an easy way in PT3, maybe someone knows a way via SQL (PG Admin)?
Thanks in advance for your help!
Re: Exporting / extracting only played hands out of a mining db

Posted:
Tue Jan 13, 2009 1:17 pm
by kraada
Run the following query, and paste the text output into a text file, then import it into your played hands db (note this assumes cash play, for tournament play, append tourney_ in front of all required tables):
select history from holdem_hand_histories, holdem_hand_player_detail, player where holdem_hand_histories.id_hand = holdem_hand_player_detail.id_hand and holdem_hand_player_detail.id_player = player.id_player and player.player_name = 'Your Username Here';
Replace "Your Usernmae Here" with your actual player username.
Re: Exporting / extracting only played hands out of a mining db

Posted:
Tue Jan 13, 2009 1:57 pm
by TroyMcLure
Hey, this looks great (yes, it's cashgame)! Thx for the quick answer

Re: Exporting / extracting only played hands out of a mining db

Posted:
Tue Jan 13, 2009 2:50 pm
by kraada
No problem; if there's anything else I can help with, you know how to find me

Re: Exporting / extracting only played hands out of a mining db

Posted:
Tue Jan 13, 2009 8:14 pm
by TroyMcLure
One additional note for users who want to do this: The query works perfectly, but after you have pasted the data into a .txt file you have to remove (-> use the "replace all" function) all " (<- double quotes) out of the file otherwise PT3 can't identify the hands.
But this was no big issue, thanks again

Re: Exporting / extracting only played hands out of a mining db

Posted:
Thu Jan 15, 2009 10:15 am
by kraada
You're welcome, and thanks for the caveat

Re: Exporting / extracting only played hands out of a mining db

Posted:
Sun Jan 18, 2009 10:23 am
by Fivetimes18
Is there any way to modify this so that I can export all hands from say January 2008 from my database?
Re: Exporting / extracting only played hands out of a mining db

Posted:
Sun Jan 18, 2009 11:29 am
by kraada
Change the query to read as follows:
select history from holdem_hand_histories, holdem_hand_player_detail, player, holdem_hand_summary where holdem_hand_histories.id_hand = holdem_hand_player_detail.id_hand and holdem_hand_summary.id_hand = holdem_hand_histories.id_hand and holdem_hand_player_detail.id_player = player.id_player and player.player_name = 'Your Username Here' and holdem_hand_summary.date_played >= '2009-Jan-01';
You can change the date as you see fit and you can also use < or <= in another one to get all hands between two dates if you'd like.