Re: guidance for using TTreeSQL ?

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Tue, 22 Feb 2011 17:39:19 -0600


Hi Rob,

This is odd and should have work. I will try to reproduce the problem.

Cheers,
Philippe.

On 2/17/11 10:28 AM, Rob Mahurin wrote:
> Hi,
>
> I have some data in a mysql database. I'd like to poke around in this
> data using root trees. I can do this by
>
> $ mysql< query.sql> data.txt
> $ vim data.txt ## fixup the header line
> $ root -l
> root[] TTree *t = new TTree;
> root[] t->ReadFile("data.txt")
>
> It looks like I should be able to use TTreeSQL:
>
> root[] TSQLServer* serv =
> TSQLServer::Connect("mysql://127.0.0.1/db", user, pass)
> root[] TSQLStatement* stmt = serv->Statement(
> "create temporary table data as ...")
> root[] stmt->Process()
> (Bool_t)1
> root[] TTreeSQL data(serv,"db","data")
>
> This fails completely: data.Print() says the tree has no branches and
> no entries.
>
> If I try to read a permanent table, TTreeSQL figures out its size, but
> none of its data:
>
> root[] TSQLStatement* stmt = serv->Statement(
> "create table foo as ...")
> root[] stmt->Process()
> (Bool_t)1
> root[] TTreeSQL foo(serv, "test", "foo")
> Error in<TTreeSQL::GetColumnIndice>: Error finding column 0 analyses__analyses
> root[] foo
> (class TTreeSQL)263684320
> root[] foo.Print()
> ******************************************************************************
> *Tree :foo : Database read from table: foo *
> *Entries : 172 : Total = 1287 bytes File Size = 0 *
> * : : Tree compression factor = 1.00 *
> ******************************************************************************
> *Br 0 :analyses : analyses/I *
> *Entries : 172 : Total Size= 490 bytes One basket in memory *
> *Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
> *............................................................................*
> *Br 1 :runlet_id : runlet_id/I *
> *Entries : 172 : Total Size= 490 bytes One basket in memory *
> *Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
> *............................................................................*
> root[] foo.Scan()
> ************************************
> * Row * analyses * runlet_id *
> ************************************
> * 0 * 0 * 0 *
> * 1 * 0 * 0 *
> * 2 * 0 * 0 *
>
> Maybe I should try to fill:
>
> root[] foo.Fill()
> Error in<TTreeSQL::GetColumnIndice>: Error finding column 0 analyses__analyses
> Error in<TTreeSQL::GetColumnIndice>: Error finding column 0 runlet_id__runlet_id
> Error in<TTreeSQL::Fill>: CheckBranch for analyses failed
> Error in<TTreeSQL::Fill>: CheckBranch for runlet_id failed
> Error in<TTreeSQL::GetColumnIndice>: Error finding column 0 analyses__analyses
> Error in<TTreeSQL::GetColumnIndice>: Error finding column 0 runlet_id__runlet_id
> (Int_t)(-1)
>
> I can verify from other queries that the tables are being created and
> filled correctly in the database. I get identical failures under
> root_v5.26/00 on a Linux cluster and under root_v5.28/00 on MacOS 10.5
> (connecting to the same server, running mysql "5.0.77-log Source
> distribution"). Is TTreeSQL just broken? Or am I missing something
> obvious?
>
> Thanks,
> Rob
>
Received on Wed Feb 23 2011 - 00:39:28 CET

This archive was generated by hypermail 2.2.0 : Wed Feb 23 2011 - 17:50:01 CET