Hi Benjamin,

2010/1/12 Benjamin Cilia <b...@quantbot.com>

> Hi all,
>
> I created a table using PyTables 2.1.2 and HDF 1.6.10 with LZO 2.02.  When
> I query the table using readWhere, I get an empty row.  However, if I query
> using 'where', I get the expected data.
>
>
> >>> from tables import *
> >>> class ticker_to_id_table_schema(IsDescription):
> ...     ticker = StringCol(12,pos=1)
> ...     id = Int32Col(pos=2)
> ...
> >>> hdf5_file = openFile('/var/tmp/test.hf5', 'w')
> >>> ids_group = hdf5_file.createGroup(hdf5_file.root, 'ids')
> >>> ids_table = hdf5_file.createTable(ids_group, 'ticker_to_id',
> ticker_to_id_table_schema, 'ticker to id table')
> >>> ids_table_row = ids_table.row
> >>> ids_table_row['ticker'] = 'IBM'
> >>> ids_table_row['id'] = 100
> >>> ids_table_row.append()
> >>> ids_table_row['ticker'] = 'GOOG'
> >>> ids_table_row['id'] = 200
> >>> ids_table_row.append()
> >>> ids_table.flush()
> >>> ids_result = ids_table.readWhere("ticker == 'IBM'")
> >>> for row in ids_result:
> ...     print "result:", row
> ...
> result: ('', 0)
> >>> ids_result = ids_table.where("ticker == 'IBM'")
> >>> for row in ids_result:
> ...     print "result:", row
> ...
> result: ('IBM', 100)
>
>
Sorry, but I cannot reproduce your problems.  Look at the ouput of using
readWhere() and where() methods with PyTables 2.1.2:

result: (100, 'IBM')
result: (100, 'IBM')

and with 2.2b2:

result: (100, 'IBM')
result: /ticker_to_id.row (Row), pointing to row #0

which are the expected results.  Which platform are you using?

-- 
Francesc Alted
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to