How to use the bsddb3.dbshelve.DBShelf function in bsddb3

To help you get started, we’ve selected a few bsddb3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gramps-project / gramps / gramps / plugins / db / bsddb / bsddbtxn.py View on Github external
Removes a key/data pair from the database
        """
        self.db.delete(key, txn or self.txn, **kwargs)

# test code
if __name__ == "__main__":
    print("1")
    from bsddb3 import db, dbshelve
    print("2")
    x = db.DBEnv()
    print("3")
    x.open('/tmp', db.DB_CREATE | db.DB_PRIVATE |\
                         db.DB_INIT_MPOOL |\
                         db.DB_INIT_LOG | db.DB_INIT_TXN)
    print("4")
    d = dbshelve.DBShelf(x)
    print("5")
    #from tran import BSDDBTxn as T
    print("6")
    T = BSDDBTxn
    with T(x) as tx:
        print("stat", tx.stat())
        print("id", tx.id())
        tx.checkpoint()