Closed ixje closed 3 years ago
i'm not entirely sure how leveldb operates internally, but generally you should just throw the WriteBatch
instance away after you're done with it, and create new one for subsequent operations. the context manager support makes this easy, since there is no need to call .write()
at all:
with db.write_batch() as wb:
for i in xrange(100000):
wb.put(str(i).encode(), str(i).encode() * 100)
Thanks
On a WriteBatch, should one call
clear()
after awrite()
or is that done implicitly whenwrite()
ing? Thanks