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) 



The really strange part is that the same 'readWhere' example using my PyTables 
2.1rc2pro build, works correctly: 

>>> 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: ('IBM', 100) 


Why is this happening? 

---------------------------------------------------
This message is confidential. It may also be privileged or otherwise
protected by work product immunity or other legal rules. If you have
received it by mistake, please let us know by e-mail reply and delete it
from your system. You may not copy this message or disclose its contents to
anyone. Quantbot Technologies reserves the right to monitor and review the
content of all messages sent to or from this e-mail address.

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to