ApdbSqlSchema

class lsst.dax.apdb.ApdbSqlSchema(engine: Engine, dia_object_index: str, htm_index_column: str, schema_file: str, schema_name: str = 'ApdbSchema', prefix: str = '', namespace: str | None = None)

Bases: ApdbSchema

Class for management of APDB schema.

Parameters:
enginesqlalchemy.engine.Engine

SQLAlchemy engine instance

dia_object_indexstr

Indexing mode for DiaObject table, see ApdbSqlConfig.dia_object_index for details.

htm_index_columnstr

Name of a HTM index column for DiaObject and DiaSource tables.

schema_filestr

Name of the YAML schema file.

schema_namestr, optional

Name of the schema in YAML files.

prefixstr, optional

Prefix to add to all scheam elements.

namespacestr, optional

Namespace (or schema name) to use for all APDB tables.

Attributes:
objectssqlalchemy.Table

DiaObject table instance

objects_lastsqlalchemy.Table

DiaObjectLast table instance, may be None

sourcessqlalchemy.Table

DiaSource table instance

forcedSourcessqlalchemy.Table

DiaForcedSource table instance

Methods Summary

column_dtype(felis_type)

Return Pandas data type for a given Felis column type.

makeSchema([drop, mysql_engine])

Create or re-create all tables.

Methods Documentation

column_dtype(felis_type: Type[FelisType]) type | str

Return Pandas data type for a given Felis column type.

Parameters:
felis_typetype

Felis type, on of the classes defined in felis.types module.

Returns:
column_dtypetype or str

Type that can be used for columns in Pandas.

Raises:
TypeError

Raised if type is cannot be handled.

makeSchema(drop: bool = False, mysql_engine: str = 'InnoDB') None

Create or re-create all tables.

Parameters:
dropbool, optional

If True then drop tables before creating new ones.

mysql_enginestr, optional

MySQL engine type to use for new tables.