remove pytables and look at bson
This commit is contained in:
parent
ef8fc4237e
commit
9c6dc549e0
@ -1,40 +0,0 @@
|
||||
import random
|
||||
|
||||
import tables
|
||||
|
||||
|
||||
class KeyValue(tables.IsDescription):
|
||||
key = tables.StringCol(itemsize=250, dflt=" ", pos=0)
|
||||
value = tables.VLStringAtom() # StringCol(itemsize=22, dflt=" ", pos=0)
|
||||
|
||||
|
||||
def make_notification():
|
||||
return [
|
||||
("foo[0]", "thing"),
|
||||
("foo[1]", "stuff"),
|
||||
("foo[1].child", "ring"),
|
||||
("foo[2].child[0]", "ding"),
|
||||
("random", random.random()),
|
||||
]
|
||||
|
||||
# open a file in "w"rite mode
|
||||
fileh = tables.open_file("storeage.h5", mode = "w")
|
||||
|
||||
root = fileh.root
|
||||
|
||||
notifications = fileh.create_group(root, "notifications")
|
||||
notification = fileh.create_table(notifications, "notification",
|
||||
tables.StringCol(itemsize=250, dflt=" ", pos=0))
|
||||
vlarray = fileh.createVLArray(notifications, 'vlarray8', tables.VLStringAtom(), "Variable Length String")
|
||||
|
||||
row = notification.row
|
||||
|
||||
for i in xrange(10):
|
||||
for k, v in make_notification():
|
||||
row['key'] = k
|
||||
row['value'] = v
|
||||
row.append()
|
||||
|
||||
notification.flush()
|
||||
|
||||
fileh.close()
|
Loading…
x
Reference in New Issue
Block a user