Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

Python binding for QDBM Database

Project description

This requires QDBM C Library (http://fallabs.com/qdbm/index.html)

Example code:

from qdbm import depot

db = depot.open(“test.db”, “n”) # depot.open(FILENAME, FLAG)

db[“apple”] = “red” # add data db[“lemon”] = “black” db[“orange”] = “orange”

db[“lemon”] = “yellow” # update data

print db[“lemon”] # get value that key is “lemon”

print db.get(“orange”, “unknown”) # get data with default value (returns orange)

print db.get(“melon”, “unknown”) # get data with default value (returns unknown)

print db.keys() # get list of keys (Python2), get iterator of keys (Python3)

print db.listkeys() # get list of keys (Python3)

for k in db.iterkeys(): # get iterator of keys (Python2)
print k
for k in db.keys(): # get iterator of keys (Python3)
print k
for k, v in db.iteritems(): # get iterator of (key, value) (Python2)
print k, v
for k, v in db.items(): # get iterator of (key, value) (Python3)
print k, v
for v in db.itervalues(): # get iterator of values (Python2)
print v
for v in db.values(): # get iterator of values (Python3)
print v

db.close() # close database object

Flags:

r: Read Only

w: Read / Write

c: Read / Write (create if not exists)

n: Read / Write (always create new file)

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
pyqdbm-0.9.6.tar.gz (7.0 kB) Copy SHA256 hash SHA256 Source None May 1, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page