LSST Applications g06d8191974+b5247657d3,g180d380827+b23588344e,g2079a07aa2+86d27d4dc4,g2305ad1205+0130fb9023,g29320951ab+7714a6b20a,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g33d1c0ed96+0e5473021a,g3a166c0a6a+0e5473021a,g3ddfee87b4+8783ab7716,g48712c4677+72a8b1060b,g487adcacf7+bbaada240a,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+ecccb6240b,g5a732f18d5+53520f316c,g5ea96fc03c+33ab2bc355,g64a986408d+b5247657d3,g858d7b2824+b5247657d3,g8a8a8dda67+585e252eca,g99cad8db69+1453026da9,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,gb0e22166c9+60f28cb32d,gba4ed39666+c2a2e4ac27,gbb8dafda3b+3751ca9c65,gc120e1dc64+c91d1388df,gc28159a63d+0e5473021a,gc3e9b769f7+241adb7c58,gcf0d15dbbd+8783ab7716,gdaeeff99f8+f9a426f77a,ge6526c86ff+acdbe9a537,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gff1a9f87cc+b5247657d3,w.2024.17
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: