from tables import *

print_versions()

hdf5_file = openFile('test.hf5', 'w')

class Ticker(IsDescription):
    id = IntCol()
    ticker = StringCol(10)

ids_table = hdf5_file.createTable(
    hdf5_file.root, 'ticker_to_id', Ticker, '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
ids_result = ids_table.where("ticker == 'IBM'")
for row in ids_result:
    print "result:", row


hdf5_file.close()