adding columns to tables

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

adding columns to tables

Postby pasita » Wed Feb 16, 2011 8:26 am

If I add columns to table player, is there a chance I run into problems during normal operation or manual housekeeping or when updating PT3?

Not counting loss of data from those columns as trouble.
pasita
 
Posts: 605
Joined: Tue May 06, 2008 4:05 pm

Re: adding columns to tables

Postby kraada » Wed Feb 16, 2011 9:57 am

You might run into problems when importing new hands as when our importer is writing a new player to the table it's expecting the schema to match what we currently have.

Other than that, off the top of my head, I don't think you'd have any trouble.
kraada
Moderator
 
Posts: 54431
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: adding columns to tables

Postby pasita » Wed Feb 16, 2011 10:35 am

Would I be better off adding those column directly to table holdem_cache? Would they be faster to use (by HUD)? I'd have to re-add after "rebuild cache" obv.

Tried importing stuff in the modified db, didn't see any immediate problems.
pasita
 
Posts: 605
Joined: Tue May 06, 2008 4:05 pm

Re: adding columns to tables

Postby kraada » Wed Feb 16, 2011 11:04 am

Make sure to try importing a hand with a player not already in the database.

Assuming that works, you should be good to go - the cache shouldn't really be touching the player table for the most part.
kraada
Moderator
 
Posts: 54431
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: adding columns to tables

Postby pasita » Wed Feb 16, 2011 8:46 pm

Everything seemed to work, except:
1) couldn't find a way to get data directly from a column in table player to a statistic
so I added columns (and my data) directly to table holdem_cache
2) but couldn't still use those for statistics (the column name won't validate nor is visible if I select Insert).

Do I have to manually create a column in the PT3 editor to be able to use it in a stat? Is there a way to overcome 1) or 2) from above?
pasita
 
Posts: 605
Joined: Tue May 06, 2008 4:05 pm

Re: adding columns to tables

Postby kraada » Thu Feb 17, 2011 10:10 am

You should be able to refer to it directly in a PT3 column as player.column_name - once you have a column built in PT3 that references your new one, you should be able to use it in a PT3 stat.
kraada
Moderator
 
Posts: 54431
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: adding columns to tables

Postby pasita » Thu Feb 17, 2011 11:03 am

To clarify: do I absolutely need to build the column first, via PT3 column editor? I'd like to refer refer player.mycol or holdem_cache.mycol directly from a statistic (mycol being something I insert from outside PT3, to either table).
pasita
 
Posts: 605
Joined: Tue May 06, 2008 4:05 pm

Re: adding columns to tables

Postby kraada » Thu Feb 17, 2011 11:40 am

Statistics can only reference PT3 columns or PT3 variables. Statistics cannot have direct SQL in them, only columns do that.
kraada
Moderator
 
Posts: 54431
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: adding columns to tables

Postby pasita » Wed Feb 23, 2011 4:28 am

I try to add a column (via PT3 stat editor) referencing the player table. The column validates, I can use it as a stat, but HUD shows nothing.
The column never appears in holdem_cache (tried refreshing and rebuilding cache), it's not in the sql CREATE TABLE holdem_cache{....} where all the other columns, protected or self made, are. Result stays same whether I'm referencing player.player_name or player.my_selfmade_column.

Am I right to assume that
1) a column has to be in the cache to be usable by hud
2) it should appear in the cache when doing a refresh?
2) it should appear in the "create table" statement?

Also,
what is player_real, what seems to be referenced by some columns? For example, column str_player_name_real is player_real.player_name. Such table doesn't exist.
pasita
 
Posts: 605
Joined: Tue May 06, 2008 4:05 pm

Re: adding columns to tables

Postby WhiteRider » Wed Feb 23, 2011 5:30 am

What column expression are you using?
How are you using that in your stat?
Which section is it in? (Holdem Cash Player Statistics?)
Have you been able to add the stat to the HUD?

A column doesn't need to be in the cache to be used in the HUD, but it is better for performance.
The column should be added to the cache when you update the cache, but it may depend on exactly what is in the column.

player_real is the real player name with original case and not the main alias name (which is used when you have linked screennames with aliases).
WhiteRider
Moderator
 
Posts: 54017
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Next

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

Who is online

Users browsing this forum: No registered users and 31 guests

cron