lsst.dax.apdb g9290983e33+d2d81de7f7
 
Loading...
Searching...
No Matches
lsst.dax.apdb.apdbSchema.ApdbSchema Class Reference
Inheritance diagram for lsst.dax.apdb.apdbSchema.ApdbSchema:
lsst.dax.apdb.sql.apdbSqlSchema.ApdbSqlSchema

Public Member Functions

 __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)
 

Public Attributes

 tableSchemas
 

Protected Member Functions

tuple[Mapping[ApdbTables, Table], VersionTuple|None] _buildSchemas (cls, str schema_file)
 

Protected Attributes

tuple[Mapping[ApdbTables, Table], VersionTuple|None] _schemaVersion = self._buildSchemas(schema_file)
 

Detailed Description

Class for management of APDB schema.

Attributes
----------
tableSchemas : `dict`
    Maps table name to `TableDef` instance.

Parameters
----------
schema_file : `str`
    Location of the YAML file with APDB schema.
ss_schema_file : `str`
    Location of the YAML file with SSO schema. File will be loaded if APDB
    schema file does not contain SSObject/SSSource tables. Can be set to
    empty string to skip loading of SSObject/SSSource schema.

Member Function Documentation

◆ _buildSchemas()

tuple[Mapping[ApdbTables, Table], VersionTuple | None] lsst.dax.apdb.apdbSchema.ApdbSchema._buildSchemas ( cls,
str schema_file )
protected
Create schema definitions for tables from felis schema.

Reads YAML schema and builds a dictionary containing
`.schema_model.Table` instances for each APDB table appearing in that
schema.

Parameters
----------
schema_file : `str`
    Name of YAML file with ``felis`` schema.

Returns
-------
tables : `dict` [`ApdbTables`, `schema_model.Table`]
    Mapping of table names to `.schema_model.Table` instances.
version : `VersionTuple` or `None`
    Schema version defined in schema file, `None` if version is not
    defined.

◆ column_dtype()

type | str lsst.dax.apdb.apdbSchema.ApdbSchema.column_dtype ( self,
felis.datamodel.DataType | ExtraDataTypes felis_type )
Return Pandas data type for a given Felis column type.

Parameters
----------
felis_type : `felis.datamodel.DataType`
    Felis type, on of the enums defined in `felis.datamodel` module.

Returns
-------
column_dtype : `type` or `str`
    Type that can be used for columns in Pandas.

Raises
------
TypeError
    Raised if type is cannot be handled.

◆ has_mjd_timestamps()

bool lsst.dax.apdb.apdbSchema.ApdbSchema.has_mjd_timestamps ( self)
True if timestamps columns are in MJD (`bool`).

◆ schemaVersion()

VersionTuple lsst.dax.apdb.apdbSchema.ApdbSchema.schemaVersion ( self)
Return schema version as defined in YAML schema file.

Returns
-------
version : `VersionTuple`
    Version number read from YAML file, if YAML file does not define
    schema version then "0.1.0" is returned.

The documentation for this class was generated from the following file: