Bekerley DB CLI - 操作伯克利数据库
2022-06-22 本文已影响0人
偷油考拉
Appendix 1. Berkeley DB Command Line Utilities (oracle.com)
Show everything that’s in the file database.db:
db_dump -p database.db
List the databases in the file database.db:
db_dump -l database.db
Show only the content of the database mydb in the file database.db:
db_dump -p -s mydb database.db
Python
from bsddb3 import db
import collections
d = db.DB()
d.open('./file.dat', 'dbname', db.DB_BTREE, db.DB_THREAD | db.DB_RDONLY)
d.keys()
collections.OrderedDict((k, d[k]) for k in d.keys())