Skip to main content

Dict-style DBM based on sqlite3.

Project description

Dict-style DBM based on sqlite3.

>>> import sqlite_dbm
>>> db = sqlite_dbm.open(':memory:')
>>> db['foo'] = ['bar', {'baz': 1}]
>>> db['foo']
['bar', {'baz': 1}]
>>> del db['foo']
>>> len(db)
0
>>> db.close()

Fast insert:

>>> db = sqlite_dbm.open(':memory:', auto_commit=False)
>>> for i in range(1000):
...     db[str(i)] = 'foo'
>>> db.commit()
>>> len(db)
1000
>>> db.clear()
>>> db.close()

sqlite_dbm.open options

  • filename - first required argument

  • auto_commit=True - auto commit after each db update

  • dumper=’pickle’ - one of ‘pickle’, ‘json’ or ‘marshal’ or ‘str’

  • compress_level=9 - if set it to 0, compression will be disabled

  • smart_compress=True - compress only if compressed size less than raw

  • pickle_protocol=2 - see pickle docs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlite_dbm-3.2.1.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

sqlite_dbm-3.2.1-py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page