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) |
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.
|
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.
| 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.
| bool lsst.dax.apdb.apdbSchema.ApdbSchema.has_mjd_timestamps | ( | self | ) |
True if timestamps columns are in MJD (`bool`).
| 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.