ZODB はオブジェクトデータベース管理システム
Windows での Python 3.10 のインストール,pip と setuptools の更新: 別ページ »で説明
Python の公式ページ: https://www.python.org/
コマンドプロンプトを管理者として実行: 別ページ »で説明
python -m pip install zodb
http://www.zodb.org/en/latest/documentation/tutorial.html (現存しない) に記載されていた account.py を使っている.
Python プログラムを実行する
import persistent import ZODB, ZODB.FileStorage, ZODB.DB import BTrees.OOBTree class Account(persistent.Persistent): def __init__(self): self.balance = 0.0 def deposit(self, amount): self.balance += amount def cash(self, amount): assert amount < self.balance self.balance -= amount storage = ZODB.FileStorage.FileStorage('mydata.fs') db = ZODB.DB(storage) connection = db.open() root = connection.root # create one object root.accounts = BTrees.OOBTree.BTree() root.accounts['account-1'] = Account() root.accounts['account-1'].balance