lsst.dax.apdb g5ea96fc03c+341ea1ce94
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
lsst.dax.apdb.apdbSchema.ApdbSchema Class Reference
Inheritance diagram for lsst.dax.apdb.apdbSchema.ApdbSchema:
lsst.dax.apdb.cassandra.apdbCassandraSchema.ApdbCassandraSchema lsst.dax.apdb.sql.apdbSqlSchema.ApdbSqlSchema

Public Member Functions

 __init__ (self, str schema_file, str schema_name="ApdbSchema")
 
type|str column_dtype (self, felis.datamodel.DataType|ExtraDataTypes felis_type)
 
VersionTuple schemaVersion (self)
 

Public Attributes

 tableSchemas
 

Protected Member Functions

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

Protected Attributes

 _schemaVersion
 

Detailed Description

Class for management of APDB schema.

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

Parameters
----------
schema_file : `str`
    Name of the YAML schema file.
schema_name : `str`, optional
    Name of the schema in YAML files.

Member Function Documentation

◆ _buildSchemas()

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

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

Parameters
----------
schema_file : `str`
    Name of YAML file with ``felis`` schema.
schema_name : `str`, optional
    Name of the schema in YAML files.

Returns
-------
tables : `dict`
    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.

◆ 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: