ApdbSqlSchema¶
- 
class lsst.dax.apdb.ApdbSqlSchema(engine: sqlalchemy.engine.base.Engine, dia_object_index: str, htm_index_column: str, schema_file: str, schema_name: str = 'ApdbSchema', prefix: str = '', namespace: Optional[str, None] = None, use_insert_id: bool = False)¶
- Bases: - lsst.dax.apdb.ApdbSchema- Class for management of APDB schema. - Parameters: - engine : sqlalchemy.engine.Engine
- SQLAlchemy engine instance 
- dia_object_index : str
- Indexing mode for DiaObject table, see - ApdbSqlConfig.dia_object_indexfor details.
- htm_index_column : str
- Name of a HTM index column for DiaObject and DiaSource tables. 
- schema_file : str
- Name of the YAML schema file. 
- schema_name : str, optional
- Name of the schema in YAML files. 
- prefix : str, optional
- Prefix to add to all schema elements. 
- namespace : str, optional
- Namespace (or schema name) to use for all APDB tables. 
- use_insert_id : bool, optional
 - 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 
- has_insert_id:- bool
- Whether insert ID tables are to be used ( - bool).
 - Attributes Summary - has_insert_id- Whether insert ID tables are to be used ( - bool).- pixel_id_tables- Tables that need pixelId column for spatial indexing. - Methods Summary - column_dtype(felis_type)- Return Pandas data type for a given Felis column type. - get_apdb_columns(table_enum, …)- Return list of columns defined for a table in APDB schema. - get_table(table_enum, …)- Return SQLAlchemy table instance for a specified table type/enum. - makeSchema(drop)- Create or re-create all tables. - Attributes Documentation - 
pixel_id_tables= (<ApdbTables.DiaObject: 'DiaObject'>, <ApdbTables.DiaObjectLast: 'DiaObjectLast'>, <ApdbTables.DiaSource: 'DiaSource'>)¶
- Tables that need pixelId column for spatial indexing. 
 - Methods Documentation - 
column_dtype(felis_type: Type[felis.types.FelisType]) → Union[type, str]¶
- Return Pandas data type for a given Felis column type. - Parameters: - felis_type : type
- Felis type, on of the classes defined in - felis.typesmodule.
 - Returns: - Raises: - TypeError
- Raised if type is cannot be handled. 
 
- felis_type : 
 - 
get_apdb_columns(table_enum: lsst.dax.apdb.apdbSchema.ApdbTables | lsst.dax.apdb.apdbSqlSchema.ExtraTables[lsst.dax.apdb.apdbSchema.ApdbTables, lsst.dax.apdb.apdbSqlSchema.ExtraTables]) → list¶
- Return list of columns defined for a table in APDB schema. - Returned list excludes columns that are implementation-specific, e.g. - pixelIdcolumn is not include in the returned list.- Parameters: - table_enum : ApdbTablesorExtraTables
- Type of table. 
 - Returns: - table : list[sqlalchemy.schema.Column]
- Table instance. 
 - Raises: - ValueError
- Raised if - table_enumis not valid for this database.
 
- table_enum : 
 - 
get_table(table_enum: lsst.dax.apdb.apdbSchema.ApdbTables | lsst.dax.apdb.apdbSqlSchema.ExtraTables[lsst.dax.apdb.apdbSchema.ApdbTables, lsst.dax.apdb.apdbSqlSchema.ExtraTables]) → sqlalchemy.sql.schema.Table¶
- Return SQLAlchemy table instance for a specified table type/enum. - Parameters: - table_enum : ApdbTablesorExtraTables
- Type of table to return. 
 - Returns: - table : sqlalchemy.schema.Table
- Table instance. 
 - Raises: - ValueError
- Raised if - table_enumis not valid for this database.
 
- table_enum : 
 
- engine :