Part 2. Persistence and Serialization
Serializing and Saving – JSON, YAML, Pickle, CSV, and XML
Storing and Retrieving Objects via Shelve
Storing and Retrieving objects via SQLite
Persistence and Serialization
A persistent object is one that has been written to some storage medium. The object can be retrieved from storage and used in a Python application. Perhaps the object was represented in JSON and written to the filesystem. Perhaps an object-relational mapping (ORM) layer has represented the object as rows in SQL tables to store the object in a database.
Serializing objects has two purposes. We serialize objects in order to make them persistent in the local filesystem. We also serialize ...
Get Mastering Object-oriented Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.