calibpipe.database.adapter package#
Adapter sub-package.
Contains all utilities to adapt CalibPipe data to a DB and use it.
Sub-package content:
database_containers: DB containers (in correspondence with CalibPipe containers) to connect CalibPipe data and the DB system.
adapter: Small class used to translate CalibPipe container data to DB-level data that can be directly inserted in a DB.
- class calibpipe.database.adapter.Adapter[source]#
Bases:
objectAdapt CalibPipe containers into DB objects.
The main method is to_postgres(), converting a CalibPipe container to a tuple containing the objects required to interact with the corresponding data in the database.
- static to_postgres(container: Container, version: str | None = None) tuple[Table, dict[str, Any]] | None[source]#
Convert a CalibPipe container in DB data that can be inserted or queried.
- Parameters:
- container: ContainerMap.cp_container
CalibPipe container (containing data) to convert to DB-level data
- version: str
Software version corresponding to the data
- Returns:
- Optional[tuple[sa.Table, dict[str, Any]]]
None if no DB table information is associated to the container. A tuple containing the SQL table corresponding to the container, and a dictionary with the valued attributes contained in the CalibPipe container.
Subpackages#
- calibpipe.database.adapter.database_containers package
TableVersionManagerContainerMap- Submodules
- calibpipe.database.adapter.database_containers.atmosphere module
- calibpipe.database.adapter.database_containers.common_metadata module
- calibpipe.database.adapter.database_containers.container_map module
- calibpipe.database.adapter.database_containers.observatory module
- calibpipe.database.adapter.database_containers.table_version_manager module
- calibpipe.database.adapter.database_containers.throughput module
- calibpipe.database.adapter.database_containers.version_control module
Submodules#
calibpipe.database.adapter.adapter module#
Adapter class.
- class calibpipe.database.adapter.adapter.Adapter[source]#
Bases:
objectAdapt CalibPipe containers into DB objects.
The main method is to_postgres(), converting a CalibPipe container to a tuple containing the objects required to interact with the corresponding data in the database.
- static to_postgres(container: Container, version: str | None = None) tuple[Table, dict[str, Any]] | None[source]#
Convert a CalibPipe container in DB data that can be inserted or queried.
- Parameters:
- container: ContainerMap.cp_container
CalibPipe container (containing data) to convert to DB-level data
- version: str
Software version corresponding to the data
- Returns:
- Optional[tuple[sa.Table, dict[str, Any]]]
None if no DB table information is associated to the container. A tuple containing the SQL table corresponding to the container, and a dictionary with the valued attributes contained in the CalibPipe container.