データの永続化
**************

The modules described in this chapter support storing Python data in a
persistent form on disk.  The "pickle" and "marshal" modules can turn
many Python data types into a stream of bytes and then recreate the
objects from the bytes.  The various DBM-related modules support a
family of hash-based file formats that store a mapping of strings to
other strings.  The "bsddb" module also provides such disk-based
string-to-string mappings based on hashing, and also supports B-Tree
and record-based formats.

この章で解説されるモジュールのリスト:

* "pickle" — Python オブジェクトの直列化

  * 他の Python モジュールとの関係

  * データストリームの形式

  * Usage

  * pickle 化、非 pickle 化できるもの

  * The pickle protocol

    * Pickling and unpickling normal class instances

    * Pickling and unpickling extension types

    * Pickling and unpickling external objects

  * Subclassing Unpicklers

  * Example

* "cPickle" — A faster "pickle"

* "copy_reg" — "pickle" サポート関数を登録する

  * 例

* "shelve" — Python オブジェクトの永続化

  * 制限事項

  * 使用例

* "marshal" — 内部使用向けの Python オブジェクト整列化

* "anydbm" — DBM 形式のデータベースへの汎用アクセスインタフェース

* "whichdb" — どの DBM モジュールがデータベースを作ったかを推測する

* "dbm" — Simple 「database」 interface

* "gdbm" — GNU による dbm の再実装

* "dbhash" — BSD データベースライブラリへの DBM 形式のインタフェース

  * データベースオブジェクト

* "bsddb" — Berkeley DB ライブラリへのインタフェース

  * ハッシュ、BTree、およびレコードオブジェクト

* "dumbdbm" — 可搬性のある DBM 実装

  * Dumbdbm オブジェクト

* "sqlite3" — SQLite データベースに対する DB-API 2.0 インタフェース

  * モジュールの関数と定数

  * Connection オブジェクト

  * カーソルオブジェクト

  * Row オブジェクト

  * SQLite と Python の型

    * はじめに

    * 追加された Python の型を SQLite データベースに格納するために適
      合 関数を使う

      * オブジェクト自身で適合するようにする

      * 適合関数を登録する

    * SQLite の値を好きな Python 型に変換する

    * デフォルトの適合関数と変換関数

  * トランザクション制御

  * "sqlite3" の効率的な使い方

    * ショートカットメソッドを使う

    * 位置ではなく名前でカラムにアクセスする

    * コネクションをコンテキストマネージャーとして利用する

  * 既知の問題

    * マルチスレッド
