Page 1 of 1

exporting selected hands from db

PostPosted: Mon Jan 26, 2009 12:01 pm
by gt_ie
I have PT3 installed. I'm trying to use the sql below that I found in an old post in order to export hands from a date range. I hope to use this in order to move them to a database on another computer to keep the 2 in synch pending the selective export functionality.

The sql doesn't work. I get the message that "relation holdem_hand_histories does not exist"

Is this sql just old PT2 sql? Is there an updated PT3 query??

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';

Re: exporting selected hands from db

PostPosted: Mon Jan 26, 2009 12:33 pm
by kraada
Are you sure you're connected to the right database on the command prompt?

Type \l and that will list all relations in the database you're connected to. holdem_hand_histories should be one of them for a PT3 database (that query won't work on a PTv2 database).

Re: exporting selected hands from db

PostPosted: Tue Jan 27, 2009 11:13 am
by gt_ie
I wasn't in the right database. Didn't realize I had to do a \c before running the sql.

The text file came back with a blank space in the first character of every line though. With that blank, the import didn't work. I had to figure out a way to strip the blank from the first character of every line in the text file. That was a bit of a pain.

Does anyone know if there is a way to omit that blank when you export the query results? Is it stored in the table (if so, maybe a substring function starting at character 2 would work)? Or, is it not in the table and it is a part of doing the \o??

If it is part of the \o, is there any way around it? Taking the file to an editor and replacing is a real pain, it would be easier just to keep exporting all of history and letting dups get thrown away.

Re: exporting selected hands from db

PostPosted: Wed Jan 28, 2009 10:28 am
by kraada
I think that space is put in by the output method; it doesn't appear in the database at the hands I'm looking for.

Some text editors would be much more efficient at pulling that space out though.

If you were playing at Full Tilt, and you were willing to use emacs, once you have the file loaded, if you pressed:
C-x ( C-s Full Tilt Poker Game C-a DEL C-n C-x )

where C-x means ctrl+x for whatever key is listed there (x, s, a, n) and DEL means the delete key on the keyboard. Then hit enter, then pressed:
C-u 50000 C-x e

and hit enter again, that would clean out the very first space of the line for 50000 hands. You could add a number higher than 50000 after C-u if you wanted more hands (or do the C-u 50000 C-x e again).

If you were playing at a different poker site, you'd want to find a different string that appears only on the first line of the hand history, and search for that instead (the C-s does a search).

highfalutin