Quick and dirty bulk export of hands

Forum for users that want to write their own custom queries against the PT database either via the Structured Query Language (SQL) or using the PT3 custom stats/reports interface.

Moderator: Moderators

Quick and dirty bulk export of hands

Postby _dave_ » Tue Mar 04, 2008 5:32 pm

I did this the other day to upgrade my database without losing mined hands, posting in case anyone else wants it. Obviously it will not be useful when the functions get built in, until then:

Open an command prompt on the computer running postgresql (Start -> Run -> "cmd" [Enter]), type (or copy/paste) these lines one at a time (THERE SHOULD BE NO LINEBREAKS):

Change the database name "PT3a31-DB1" to whatever you want to query, and change the txt file names at the end if you like.

Code: Select all
psql -A -t -d "PT3a31-DB1" -U postgres -c "select history from holdem_hand_histories hhh, holdem_hand_summary hhs WHERE hhh.id_hand = hhs.id_hand AND hhs.id_site = 100;" -o stars_hh.txt

Code: Select all
psql -A -t -d "PT3a31-DB1" -U postgres -c "select history from holdem_hand_histories hhh, holdem_hand_summary hhs WHERE hhh.id_hand = hhs.id_hand AND hhs.id_site = 200;" -o party_hh.txt

Code: Select all
psql -A -t -d "PT3a31-DB1" -U postgres -c "select history from holdem_hand_histories hhh, holdem_hand_summary hhs WHERE hhh.id_hand = hhs.id_hand AND hhs.id_site = 300;" -o ftp_hh.txt


it should chug for a while and make some big text files which you can later import / archive / whatever.
_dave_
 
Posts: 1147
Joined: Sun Dec 09, 2007 6:19 pm

Re: Quick and dirty bulk export of hands

Postby Lateksi » Tue Mar 04, 2008 8:16 pm

"out of memory query result" for Full Tilt export :(
Lateksi
 
Posts: 5
Joined: Wed Feb 27, 2008 5:57 am

Re: Quick and dirty bulk export of hands

Postby _dave_ » Tue Mar 04, 2008 8:26 pm

Do the other two work OK, or only FTP hands in your database? How many FTP hands is there?
_dave_
 
Posts: 1147
Joined: Sun Dec 09, 2007 6:19 pm

Re: Quick and dirty bulk export of hands

Postby Lateksi » Tue Mar 04, 2008 11:00 pm

[quote="_dave_"rfu]Do the other two work OK, or only FTP hands in your database? How many FTP hands is there?[/quoterfu]
I only play at Full Tilt so I didn't try them, I have around 3.5 mil hands I believe, how do I see it in PT3 anyway?
Lateksi
 
Posts: 5
Joined: Wed Feb 27, 2008 5:57 am

Re: Quick and dirty bulk export of hands

Postby Dazarath » Tue Mar 04, 2008 11:04 pm

You should be able to enter all those into a .cmd file and do it all in one run, correct?
Dazarath
 
Posts: 268
Joined: Sun Dec 09, 2007 2:25 am

Re: Quick and dirty bulk export of hands

Postby _dave_ » Tue Mar 04, 2008 11:05 pm

[codejp2]psql -A -t -d "PT3a31-DB1" -U postgres -c "select count(id_hand) from holdem_hand_summary hhs WHERE hhs.id_site = 300;" -o count_ftp_hh.txt[/codejp2]

will give you a file containing hand count.
_dave_
 
Posts: 1147
Joined: Sun Dec 09, 2007 6:19 pm

Re: Quick and dirty bulk export of hands

Postby _dave_ » Tue Mar 04, 2008 11:06 pm

[quote="Dazarath"8cm]You should be able to enter all those into a .cmd file and do it all in one run, correct?[/quote8cm]

Indeed you should, but it looks like a large database causes out of memory errors :(

I only tested on my few 100K database, and I've increased the postgres memory allocation via postgresql.conf already.
_dave_
 
Posts: 1147
Joined: Sun Dec 09, 2007 6:19 pm

Re: Quick and dirty bulk export of hands

Postby Lateksi » Wed Mar 05, 2008 5:56 am

4135665 hands.

I noticed I had Party tournament hands (30-40k), I imported them and exporting them worked fine.
I've fiddled around with the .conf file too, but my values are probably still pretty conservative because I don't know a first thing about SQL - but they're not at defaults at least.
Lateksi
 
Posts: 5
Joined: Wed Feb 27, 2008 5:57 am

Re: Quick and dirty bulk export of hands

Postby omaha » Sun Jul 13, 2008 8:11 am

I got an out of memory for query result as well.

I have played about 75k hands at party, and have a massive db as well.

When i copied/pasted that code, was that exporting all the hands, or just mine?

Do i need to put my screenname in somewhere, or how does it know which hands are mine?
omaha
 
Posts: 215
Joined: Sat Dec 22, 2007 8:39 pm

Re: Quick and dirty bulk export of hands

Postby omaha » Sun Jul 13, 2008 8:18 am

Lateski, how did you increase the memory?

I have looked around in the conf file, and there is shared buffers/temp buffers

Or is it something else?
omaha
 
Posts: 215
Joined: Sat Dec 22, 2007 8:39 pm

Next

Return to Custom Stats, Reports, and SQL [Read Only]

Who is online

Users browsing this forum: No registered users and 7 guests