persistence.md
1> **Источник:** https://python-all.ru/3.14/library/persistence.html2>3> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.45---67# Персистентность данных89Модули, описанные в этой главе, поддерживают сохранение данных Python на диск в персистентной форме. Модули [`pickle`](https://python-all.ru/3.14/library/pickle.html#module-pickle) и [`marshal`](https://python-all.ru/3.14/library/marshal.html#module-marshal) могут преобразовывать многие типы данных Python в поток байтов, а затем восстанавливать объекты из байтов. Различные модули, связанные с DBM, поддерживают семейство хеш-форматов файлов, которые хранят отображение строк на другие строки.1011Список модулей, описанных в этой главе:1213- [`pickle` – Сериализация объектов Python](https://python-all.ru/3.14/library/pickle.html)1415 - [Связь с другими модулями Python](https://python-all.ru/3.14/library/pickle.html#relationship-to-other-python-modules)1617 - [Сравнение с `marshal`](https://python-all.ru/3.14/library/pickle.html#comparison-with-marshal)18 - [Сравнение с `json`](https://python-all.ru/3.14/library/pickle.html#comparison-with-json)19 - [Формат потока данных](https://python-all.ru/3.14/library/pickle.html#data-stream-format)20 - [Интерфейс модуля](https://python-all.ru/3.14/library/pickle.html#module-interface)21 - [Что можно сериализовать и десериализовать?](https://python-all.ru/3.14/library/pickle.html#what-can-be-pickled-and-unpickled)22 - [Сериализация экземпляров классов](https://python-all.ru/3.14/library/pickle.html#pickling-class-instances)2324 - [Сохранение внешних объектов](https://python-all.ru/3.14/library/pickle.html#persistence-of-external-objects)25 - [Диспетчерские таблицы](https://python-all.ru/3.14/library/pickle.html#dispatch-tables)26 - [Обработка объектов с состоянием](https://python-all.ru/3.14/library/pickle.html#handling-stateful-objects)27 - [Пользовательская редукция для типов, функций и других объектов](https://python-all.ru/3.14/library/pickle.html#custom-reduction-for-types-functions-and-other-objects)28 - [Внеполосные буферы](https://python-all.ru/3.14/library/pickle.html#out-of-band-buffers)2930 - [API провайдера](https://python-all.ru/3.14/library/pickle.html#provider-api)31 - [API потребителя](https://python-all.ru/3.14/library/pickle.html#consumer-api)32 - [Пример](https://python-all.ru/3.14/library/pickle.html#example)33 - [Ограничение глобальных переменных](https://python-all.ru/3.14/library/pickle.html#restricting-globals)34 - [Производительность](https://python-all.ru/3.14/library/pickle.html#performance)35 - [Примеры](https://python-all.ru/3.14/library/pickle.html#examples)36 - [Интерфейс командной строки](https://python-all.ru/3.14/library/pickle.html#command-line-interface)37- [`copyreg` – Регистрация вспомогательных функций `pickle`](https://python-all.ru/3.14/library/copyreg.html)3839 - [Пример](https://python-all.ru/3.14/library/copyreg.html#example)40- [`shelve` – Персистентность объектов Python](https://python-all.ru/3.14/library/shelve.html)4142 - [Ограничения](https://python-all.ru/3.14/library/shelve.html#restrictions)43 - [Пример](https://python-all.ru/3.14/library/shelve.html#example)44- [`marshal` – Внутренняя сериализация объектов Python](https://python-all.ru/3.14/library/marshal.html)45- [`dbm` – Интерфейсы к Unix-«базам данных»](https://python-all.ru/3.14/library/dbm.html)4647 - [`dbm.sqlite3` – Бэкенд SQLite для dbm](https://python-all.ru/3.14/library/dbm.html#module-dbm.sqlite3)48 - [`dbm.gnu` – Менеджер баз данных GNU](https://python-all.ru/3.14/library/dbm.html#module-dbm.gnu)49 - [`dbm.ndbm` – Новый менеджер баз данных](https://python-all.ru/3.14/library/dbm.html#module-dbm.ndbm)50 - [`dbm.dumb` – Переносимая реализация DBM](https://python-all.ru/3.14/library/dbm.html#module-dbm.dumb)51- [`sqlite3` – Интерфейс DB-API 2.0 для баз данных SQLite](https://python-all.ru/3.14/library/sqlite3.html)5253 - [Учебное пособие](https://python-all.ru/3.14/library/sqlite3.html#tutorial)54 - [Справочник](https://python-all.ru/3.14/library/sqlite3.html#reference)5556 - [Функции модуля](https://python-all.ru/3.14/library/sqlite3.html#module-functions)57 - [Константы модуля](https://python-all.ru/3.14/library/sqlite3.html#module-constants)58 - [Объекты соединения](https://python-all.ru/3.14/library/sqlite3.html#connection-objects)59 - [Объекты курсора](https://python-all.ru/3.14/library/sqlite3.html#cursor-objects)60 - [Объекты строки](https://python-all.ru/3.14/library/sqlite3.html#row-objects)61 - [Объекты Blob](https://python-all.ru/3.14/library/sqlite3.html#blob-objects)62 - [Объекты PrepareProtocol](https://python-all.ru/3.14/library/sqlite3.html#prepareprotocol-objects)63 - [Исключения](https://python-all.ru/3.14/library/sqlite3.html#exceptions)64 - [Типы SQLite и Python](https://python-all.ru/3.14/library/sqlite3.html#sqlite-and-python-types)65 - [Адаптеры и конвертеры по умолчанию (устарело)](https://python-all.ru/3.14/library/sqlite3.html#default-adapters-and-converters-deprecated)66 - [Интерфейс командной строки](https://python-all.ru/3.14/library/sqlite3.html#command-line-interface)67 - [Инструкции](https://python-all.ru/3.14/library/sqlite3.html#how-to-guides)6869 - [Как использовать заполнители для привязки значений в SQL-запросах](https://python-all.ru/3.14/library/sqlite3.html#how-to-use-placeholders-to-bind-values-in-sql-queries)70 - [Как адаптировать пользовательские типы Python к значениям SQLite](https://python-all.ru/3.14/library/sqlite3.html#how-to-adapt-custom-python-types-to-sqlite-values)7172 - [Как создавать адаптируемые объекты](https://python-all.ru/3.14/library/sqlite3.html#how-to-write-adaptable-objects)73 - [Как регистрировать адаптеры-вызываемые объекты](https://python-all.ru/3.14/library/sqlite3.html#how-to-register-adapter-callables)74 - [Как преобразовывать значения SQLite в пользовательские типы Python](https://python-all.ru/3.14/library/sqlite3.html#how-to-convert-sqlite-values-to-custom-python-types)75 - [Рецепты адаптеров и преобразователей](https://python-all.ru/3.14/library/sqlite3.html#adapter-and-converter-recipes)76 - [Как использовать сокращённые методы соединения](https://python-all.ru/3.14/library/sqlite3.html#how-to-use-connection-shortcut-methods)77 - [Как использовать контекстный менеджер соединения](https://python-all.ru/3.14/library/sqlite3.html#how-to-use-the-connection-context-manager)78 - [Как работать с URI SQLite](https://python-all.ru/3.14/library/sqlite3.html#how-to-work-with-sqlite-uris)79 - [Как создавать и использовать фабрики строк](https://python-all.ru/3.14/library/sqlite3.html#how-to-create-and-use-row-factories)80 - [Как обрабатывать кодировки текста, отличные от UTF-8](https://python-all.ru/3.14/library/sqlite3.html#how-to-handle-non-utf-8-text-encodings)81 - [Пояснения](https://python-all.ru/3.14/library/sqlite3.html#explanation)8283 - [Управление транзакциями](https://python-all.ru/3.14/library/sqlite3.html#transaction-control)8485 - [Управление транзакциями через атрибут `autocommit`](https://python-all.ru/3.14/library/sqlite3.html#transaction-control-via-the-autocommit-attribute)86 - [Управление транзакциями через атрибут `isolation_level`](https://python-all.ru/3.14/library/sqlite3.html#transaction-control-via-the-isolation-level-attribute)87