Public Member Functions | |
| __init__ (self, sqlalchemy.engine.Engine engine, str dia_object_index, str htm_index_column, str schema_file, str ss_schema_file, str prefix="", str|None namespace=None, bool enable_replica=False) | |
| bool | empty (self) |
| None | makeSchema (self, bool drop=False) |
| sqlalchemy.schema.Table | get_table (self, ApdbTables|ExtraTables table_enum) |
| bool | check_column (self, ApdbTables|ExtraTables table_enum, str column) |
| list[sqlalchemy.schema.Column] | get_apdb_columns (self, ApdbTables|ExtraTables table_enum) |
| bool | replication_enabled (self) |
Public Member Functions inherited from lsst.dax.apdb.apdbSchema.ApdbSchema | |
| __init__ (self, str schema_file, str ss_schema_file) | |
| type|str | column_dtype (self, felis.datamodel.DataType|ExtraDataTypes felis_type) |
| VersionTuple | schemaVersion (self) |
| bool | has_mjd_timestamps (self) |
Static Public Attributes | |
| tuple | pixel_id_tables = (ApdbTables.DiaObject, ApdbTables.DiaObjectLast, ApdbTables.DiaSource) |
Protected Member Functions | |
| Mapping[ApdbTables, schema_model.Table] | _make_apdb_tables (self, str mysql_engine="InnoDB") |
| Mapping[ExtraTables, schema_model.Table] | _make_extra_tables (self, Mapping[ApdbTables, schema_model.Table] apdb_tables) |
| list[schema_model.Column] | _replicaChunkColumns (self, ExtraTables table_enum, ApdbTables apdb_enum) |
| list[schema_model.Index] | _replicaChunkIndices (self, ExtraTables table_enum, Mapping[str, schema_model.Column] column_map) |
| list[schema_model.Constraint] | _replicaChunkConstraints (self, ExtraTables table_enum, schema_model.Table apdb_table, schema_model.Table parent_table, Mapping[str, schema_model.Column] column_map) |
Protected Member Functions inherited from lsst.dax.apdb.apdbSchema.ApdbSchema | |
| tuple[Mapping[ApdbTables, Table], VersionTuple|None] | _buildSchemas (cls, str schema_file) |
Protected Attributes | |
| _engine = engine | |
| _dia_object_index = dia_object_index | |
| _htm_index_column = htm_index_column | |
| _prefix = prefix | |
| _enable_replica = enable_replica | |
| _metadata = sqlalchemy.schema.MetaData(schema=namespace) | |
| dict | _apdb_tables |
| dict | _extra_tables |
| bool|None | _has_replica_chunks = None |
| bool|None | _metadata_check = None |
Protected Attributes inherited from lsst.dax.apdb.apdbSchema.ApdbSchema | |
| tuple[Mapping[ApdbTables, Table], VersionTuple|None] | _schemaVersion = self._buildSchemas(schema_file) |
Additional Inherited Members | |
Public Attributes inherited from lsst.dax.apdb.apdbSchema.ApdbSchema | |
| tableSchemas | |
Class for management of APDB schema.
Attributes
----------
objects : `sqlalchemy.Table`
DiaObject table instance
objects_last : `sqlalchemy.Table`
DiaObjectLast table instance, may be None
sources : `sqlalchemy.Table`
DiaSource table instance
forcedSources : `sqlalchemy.Table`
DiaForcedSource table instance
replication_enabled : `bool`
If true then schema has tables for replication chunks.
Parameters
----------
engine : `sqlalchemy.engine.Engine`
SQLAlchemy engine instance
dia_object_index : `str`
Indexing mode for DiaObject table, see `ApdbSqlConfig.dia_object_index`
for details.
htm_index_column : `str`
Name of a HTM index column for DiaObject and DiaSource tables.
schema_file : `str`
Location of the YAML file with APDB schema.
ss_schema_file : `str`
Location of the YAML file with SSP schema.
prefix : `str`, optional
Prefix to add to all schema elements.
namespace : `str`, optional
Namespace (or schema name) to use for all APDB tables.
enable_replica : `bool`, optional
If `True` then use additional tables for replica chunks.
|
protected |
Generate schema for regular tables.
Parameters
----------
mysql_engine : `str`, optional
MySQL engine type to use for new tables.
|
protected |
Generate schema for insert ID tables.
|
protected |
Return list of columns for replica chunks tables.
|
protected |
Return set of constraints for replica chunk table.
|
protected |
Return set of indices for replica chunk table.
| bool lsst.dax.apdb.sql.apdbSqlSchema.ApdbSqlSchema.check_column | ( | self, | |
| ApdbTables | ExtraTables | table_enum, | ||
| str | column ) |
Check for the existence of the column in a given table, checking is
done against database, not APDB schema.
Parameters
----------
table_enum : `ApdbTables` or `ExtraTables`
Table to check for a column.
column : `str`
Name of the column to check.
Returns
-------
exists : `bool`
True if column exists, False otherwise.
| bool lsst.dax.apdb.sql.apdbSqlSchema.ApdbSqlSchema.empty | ( | self | ) |
Return True if database schema is empty.
Returns
-------
empty : `bool`
`True` if none of the required APDB tables exist in the database,
`False` if all required tables exist.
Raises
------
InconsistentSchemaError
Raised when some of the required tables exist but not all.
| list[sqlalchemy.schema.Column] lsst.dax.apdb.sql.apdbSqlSchema.ApdbSqlSchema.get_apdb_columns | ( | self, | |
| ApdbTables | ExtraTables | table_enum ) |
Return list of columns defined for a table in APDB schema.
Returned list excludes columns that are implementation-specific, e.g.
``pixelId`` column is not include in the returned list.
Parameters
----------
table_enum : `ApdbTables` or `ExtraTables`
Type of table.
Returns
-------
table : `list` [`sqlalchemy.schema.Column`]
Table instance.
Raises
------
ValueError
Raised if ``table_enum`` is not valid for this database.
| sqlalchemy.schema.Table lsst.dax.apdb.sql.apdbSqlSchema.ApdbSqlSchema.get_table | ( | self, | |
| ApdbTables | ExtraTables | table_enum ) |
Return SQLAlchemy table instance for a specified table type/enum.
Parameters
----------
table_enum : `ApdbTables` or `ExtraTables`
Type of table to return.
Returns
-------
table : `sqlalchemy.schema.Table`
Table instance.
Raises
------
ValueError
Raised if ``table_enum`` is not valid for this database.
| None lsst.dax.apdb.sql.apdbSqlSchema.ApdbSqlSchema.makeSchema | ( | self, | |
| bool | drop = False ) |
Create or re-create all tables.
Parameters
----------
drop : `bool`, optional
If True then drop tables before creating new ones.
| bool lsst.dax.apdb.sql.apdbSqlSchema.ApdbSqlSchema.replication_enabled | ( | self | ) |
True if replication is enabled (`bool`).
|
protected |
|
protected |