Save and access data ==================== To store data persistently, a process called serialisation or marshalling can be used. In it, data structures are converted into a linear form and stored. The reverse process is then called deserialisation or unmarshalling. Python offers several modules in the standard library that you can be used to serialise and deserialise objects: the :doc:`marshal ` module is mainly used internally by Python and should not be used to store data in a backwards compatible way. the :doc:`pickle ` module if you don’t need a readable format or interoperability. the :doc:`json ` module you can use to exchange data for different languages in a readable form. the :doc:`xml ` module you can also use to exchange data in different languages in a readable form. .. tip:: `cusy Seminar `_ The Python Database API ----------------------- The Python Database :abbr:`API (Application Programming Interface)` defines a standard interface for Python database access modules. It’s defined in :pep:`249` and widely used, for example by :doc:`sqlite `, :doc:`psycopg `, and `mysql-python `_. SQLAlchemy ---------- :doc:`Python4DataScience:data-processing/postgresql/sqlalchemy` is a widely used database toolkit. It provides not only an :abbr:`ORM (Object Relational Mapper)` but also a generalised API for writing database-agnostic code without SQL. :doc:`Python4DataScience:data-processing/postgresql/alembic` is based on SQLAlchemy and serves as a database migration tool. NoSQL databases --------------- There is data that is difficult to transfer into a relational data model. At the least then you should take a look at :doc:`Python4DataScience:data-processing/nosql/index`. .. toctree:: :titlesonly: :hidden: filesystem pickle xml sqlite create-db create-data create-data-from-csv query-data update-data delete-data normalise query-normalised psycopg