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)

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.

Methods Summary

clusteringColumns(table_name)

Return a list of columns used for clustering.

getColumnMap(table_name)

Returns mapping of column names to Column definitions.

makeSchema([drop, part_range])

Create or re-create all tables.

partitionColumns(table_name)

Return a list of columns used for table partitioning.

tableName(table_name)

Return Cassandra table name for APDB table.

Methods Documentation

clusteringColumns(table_name: Union[ApdbTables, ExtraTables]) List[str]

Return a list of columns used for clustering.

Parameters:
table_nameApdbTables

Table name in APDB schema

Returns:
columnslist of str

Names of columns for used for clustering.

getColumnMap(table_name: Union[ApdbTables, ExtraTables]) Mapping[str, ColumnDef]

Returns mapping of column names to Column definitions.

Parameters:
table_nameApdbTables

One of known APDB table names.

Returns:
column_mapdict

Mapping of column names to ColumnDef instances.

makeSchema(drop: bool = False, part_range: Optional[Tuple[int, int]] = None) None

Create or re-create all tables.

Parameters:
dropbool

If True then drop tables before creating new ones.

part_rangetuple [ int ] or None

Start and end partition number for time partitions, end is not inclusive. Used to create per-partition DiaObject, DiaSource, and DiaForcedSource tables. If None then per-partition tables are not created.

partitionColumns(table_name: Union[ApdbTables, ExtraTables]) List[str]

Return a list of columns used for table partitioning.

Parameters:
table_nameApdbTables

Table name in APDB schema

Returns:
columnslist of str

Names of columns for used for partitioning.

tableName(table_name: Union[ApdbTables, ExtraTables]) str

Return Cassandra table name for APDB table.