import lmdb
env = lmdb.open(path_to_lmdb)
Now I seem to need to create a transaction and a cursor, but how do I get a list of keys that I can iterate over?
A way to get the total number of keys without enumerating them individually, counting also all sub databases:
with env.begin() as txn:
length = txn.stat()['entries']
Test result with a hand-made database of size 1000000 on my laptop: