From: David S. <da...@dr...> - 2004-01-20 17:42:32
|
Hello, I am prototyping an application with pytables acting as the storage layer. I am wanting to add a simple index of the data being collected in a table. Data collection for this table will occur over weeks and months. I was wanting to store a timestamp for each day of recorded data in a dictionary attached to this table with the day timestamp as the key and the index of the first row being added to the table for this day as the value. What I was hoping to accomplish was an ability to lookup a timestamp in the dictionary, returning the row index and then utitlize that for selection of records or removal of records for particular days. What I have done is added a an attribute like so: table.attrs.dayIndex = {} When I first create the hdf5 file and create the groups and tables and add data, the dayIndex attribute functions as a dictionary should. When I flush and save this data to the hdf5 file, close and reopen the file, the attribute becomes a string and no longer functions as a dictionary. My question is, how may I accomplish this and after a reopening of the hdf5 file, still utilize python dictionaries stored as attributes? Are there other methods that I may use that would be as or more efficient. Like storing another table as a leaf of the table that stores the items I want to index. Thanks, David Sumner |