ApdbCassandraSchema¶
- class lsst.dax.apdb.ApdbCassandraSchema(session: cassandra.cluster.Session, keyspace: str, schema_file: str, schema_name: str = 'ApdbSchema', prefix: str = '', time_partition_tables: bool = False, use_insert_id: bool = False)¶
- Bases: - ApdbSchema- Class for management of APDB schema. - Parameters:
- sessioncassandra.cluster.Session
- Cassandra session object 
- 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 schema elements. 
- time_partition_tablesbool
- If True then schema will have a separate table for each time partition. 
 
- session
 - Attributes Summary - Whether insert ID tables are to be used ( - bool).- Methods Summary - apdbColumnNames(table_name)- Return a list of columns names for a table as defined in APDB schema. - clusteringColumns(table_name)- Return a list of columns used for clustering. - column_dtype(felis_type)- Return Pandas data type for a given Felis column type. - empty()- Return True if database schema is empty. - getColumnMap(table_name)- Return mapping of column names to Column definitions. - keyspace()- Return Cassandra keyspace for APDB tables. - makeSchema([drop, part_range])- Create or re-create all tables. - partitionColumns(table_name)- Return a list of columns used for table partitioning. - Return schema version as defined in YAML schema file. - tableName(table_name)- Return Cassandra table name for APDB table. - Attributes Documentation - Methods Documentation - apdbColumnNames(table_name: ApdbTables | ExtraTables) list[str]¶
- Return a list of columns names for a table as defined in APDB schema. - Parameters:
- table_nameApdbTablesorExtraTables
- Enum for a table in APDB schema. 
 
- table_name
- Returns:
 
 - clusteringColumns(table_name: ApdbTables | ExtraTables) list[str]¶
- Return a list of columns used for clustering. - Parameters:
- table_nameApdbTables
- Table name in APDB schema 
 
- table_name
- Returns:
 
 - column_dtype(felis_type: type[felis.types.FelisType]) type | str¶
- Return Pandas data type for a given Felis column type. 
 - getColumnMap(table_name: ApdbTables | ExtraTables) Mapping[str, Column]¶
- Return mapping of column names to Column definitions. - Parameters:
- table_nameApdbTables
- One of known APDB table names. 
 
- table_name
- Returns:
- column_mapdict
- Mapping of column names to - ColumnDefinstances.
 
- column_map
 
 - makeSchema(drop: bool = False, part_range: tuple[int, int] | None = None) None¶
- Create or re-create all tables. - Parameters:
 
 - partitionColumns(table_name: ApdbTables | ExtraTables) list[str]¶
- Return a list of columns used for table partitioning. - Parameters:
- table_nameApdbTables
- Table name in APDB schema 
 
- table_name
- Returns:
 
 - schemaVersion() VersionTuple¶
- Return schema version as defined in YAML schema file. - Returns:
- versionVersionTuple
- Version number read from YAML file, if YAML file does not define schema version then “0.1.0” is returned. 
 
- version
 
 - tableName(table_name: ApdbTables | ExtraTables) str¶
- Return Cassandra table name for APDB table.