SQLStorageManager
- class caqtus.session.sql.SQLStorageManager(
- serializer: SerializerProtocol,
- engine: Engine,
- async_engine: AsyncEngine,
Bases:
StorageManagerUsed to access experiment storage were the data are stored in a SQL database.
This session maker can create session that connects to a database using sqlalchemy.
This object is pickleable and can be passed to other processes, assuming that the database referenced by the engine is accessible from the other processes. In particular, in-memory sqlite databases are not accessible from other processes.
- Parameters:
engine – This is used by the sessions to connect to the database. See sqlalchemy documentation for more information on how to create an engine.
serializer – This is used to convert user defined objects to a JSON format that can be stored in the database.
- async_session() AsyncExperimentSession
Create a new asynchronous experiment session.
- check() None
Check if the database is up to date with the application schema.
- Raises:
InvalidDatabaseSchema – If the database schema is not compatible with the application schema.
- upgrade() None
Updates the database schema to the latest version.
When called on a database already setup, this method will upgrade the database tables to the latest version. When called on an empty database, this method will create the necessary tables.
Warning
It is strongly recommended to back up the database before running this method in case something goes wrong.