LSST Applications 27.0.0,g0265f82a02+469cd937ee,g02d81e74bb+21ad69e7e1,g1470d8bcf6+cbe83ee85a,g2079a07aa2+e67c6346a6,g212a7c68fe+04a9158687,g2305ad1205+94392ce272,g295015adf3+81dd352a9d,g2bbee38e9b+469cd937ee,g337abbeb29+469cd937ee,g3939d97d7f+72a9f7b576,g487adcacf7+71499e7cba,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+df404f777f,g5a732f18d5+be83d3ecdb,g64a986408d+21ad69e7e1,g858d7b2824+21ad69e7e1,g8a8a8dda67+a6fc98d2e7,g99cad8db69+f62e5b0af5,g9ddcbc5298+d4bad12328,ga1e77700b3+9c366c4306,ga8c6da7877+71e4819109,gb0e22166c9+25ba2f69a1,gb6a65358fc+469cd937ee,gbb8dafda3b+69d3c0e320,gc07e1c2157+a98bf949bb,gc120e1dc64+615ec43309,gc28159a63d+469cd937ee,gcf0d15dbbd+72a9f7b576,gdaeeff99f8+a38ce5ea23,ge6526c86ff+3a7c1ac5f1,ge79ae78c31+469cd937ee,gee10cc3b42+a6fc98d2e7,gf1cff7945b+21ad69e7e1,gfbcc870c63+9a11dc8c8f
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
lsst.dax.apdb.schema_model.Table Class Reference

Public Member Functions

None __post_init__ (self)
 
Table from_felis (cls, felis.datamodel.Table dm_table, Mapping[str, Column] columns)
 

Static Public Attributes

str name
 
str id
 
list columns [Column]
 
list primary_key [Column]
 
list constraints [Constraint]
 
list indexes [Index]
 
str description = None
 
Mapping annotations = dataclasses.field(default_factory=dict)
 

Detailed Description

Description of a single table schema.

Definition at line 336 of file schema_model.py.

Member Function Documentation

◆ __post_init__()

None lsst.dax.apdb.schema_model.Table.__post_init__ ( self)
Update all columns to point to this table.

Definition at line 363 of file schema_model.py.

363 def __post_init__(self) -> None:
364 """Update all columns to point to this table."""
365 for column in self.columns:
366 column.table = self
367

◆ from_felis()

Table lsst.dax.apdb.schema_model.Table.from_felis ( cls,
felis.datamodel.Table dm_table,
Mapping[str, Column] columns )
Convert Felis table definition into instance of this class.

Parameters
----------
dm_table : `felis.datamodel.Table`
    Felis table definition.
columns : `~collections.abc.Mapping` [`str`, `Column`]
    Mapping of column ID to `Column` instance.

Returns
-------
table : `Table`
    Converted table definition.

Definition at line 369 of file schema_model.py.

369 def from_felis(cls, dm_table: felis.datamodel.Table, columns: Mapping[str, Column]) -> Table:
370 """Convert Felis table definition into instance of this class.
371
372 Parameters
373 ----------
374 dm_table : `felis.datamodel.Table`
375 Felis table definition.
376 columns : `~collections.abc.Mapping` [`str`, `Column`]
377 Mapping of column ID to `Column` instance.
378
379 Returns
380 -------
381 table : `Table`
382 Converted table definition.
383 """
384 table_columns = [columns[c.id] for c in dm_table.columns]
385 if dm_table.primary_key:
386 pk_columns = [columns[c] for c in _make_iterable(dm_table.primary_key)]
387 else:
388 pk_columns = []
389 constraints = [Constraint.from_felis(constr, columns) for constr in dm_table.constraints]
390 indices = [Index.from_felis(dm_idx, columns) for dm_idx in dm_table.indexes]
391 table = cls(
392 name=dm_table.name,
393 id=dm_table.id,
394 columns=table_columns,
395 primary_key=pk_columns,
396 constraints=constraints,
397 indexes=indices,
398 description=dm_table.description,
399 annotations=_strip_keys(
400 dict(dm_table),
401 ["name", "id", "columns", "primaryKey", "constraints", "indexes", "description"],
402 ),
403 )
404 return table
405
406
407@dataclasses.dataclass

Member Data Documentation

◆ annotations

Mapping lsst.dax.apdb.schema_model.Table.annotations = dataclasses.field(default_factory=dict)
static

Definition at line 360 of file schema_model.py.

◆ columns

list lsst.dax.apdb.schema_model.Table.columns [Column]
static

Definition at line 345 of file schema_model.py.

◆ constraints

list lsst.dax.apdb.schema_model.Table.constraints [Constraint]
static

Definition at line 351 of file schema_model.py.

◆ description

str lsst.dax.apdb.schema_model.Table.description = None
static

Definition at line 357 of file schema_model.py.

◆ id

str lsst.dax.apdb.schema_model.Table.id
static

Definition at line 342 of file schema_model.py.

◆ indexes

list lsst.dax.apdb.schema_model.Table.indexes [Index]
static

Definition at line 354 of file schema_model.py.

◆ name

str lsst.dax.apdb.schema_model.Table.name
static

Definition at line 339 of file schema_model.py.

◆ primary_key

list lsst.dax.apdb.schema_model.Table.primary_key [Column]
static

Definition at line 348 of file schema_model.py.


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