jnwatson / py-lmdb

Universal Python binding for the LMDB 'Lightning' Database
http://lmdb.readthedocs.io/
Other
646 stars 106 forks source link

Can I customize the name of data.mdb #326

Closed guods closed 2 years ago

guods commented 2 years ago

Edit this issue template as appropriate. If none of it seems relevant to your issue, then you may delete the entire template, however, I may not respond to issues that do not include important information that is mentioned in this template!

Affected Operating Systems

Affected py-lmdb Version

e.g. "print lmdb.__version__"

py-lmdb Installation Method

e.g. sudo pip install lmdb

Using bundled or distribution-provided LMDB library?

Bundled

Distribution name and LMDB library version

Use "print lmdb.version()" from a Python prompt.

Machine "free -m" output

e.g.

             total       used       free     shared    buffers     cached
Mem:         24154      23874        279         21        386       8175
-/+ buffers/cache:      15313       8840
Swap:            0          0          0

Other important machine info

Running under cgroups? Containers? Weird filesystems in use? Network filesystem? Patched kernel? ...

Describe Your Problem

XXXXX

Errors/exceptions Encountered

e.g.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
MemoryError

Describe What You Expected To Happen

e.g.

I expected the transaction to commit successfully.

Describe What Happened Instead

e.g.

The Python process crashed.

jnwatson commented 2 years ago

You can use the no-directory option and then you can call it whatever you want.

guods commented 2 years ago

@jnwatson I can not understand it, I do not know how to call it without no-directory? I open my database with "lmdb.Environment(path=mypath)", but the name of databse is "person.mdb", I should call it by......?

jnwatson commented 2 years ago
import lmdb
env = lmdb.Environment('mydatabase.whatever', subdir=False)