addDimensionForeignKey¶
-
lsst.daf.butler.
addDimensionForeignKey
(tableSpec: ddl.TableSpec, dimension: Dimension, *, primaryKey: bool, nullable: bool = False) → ddl.FieldSpec¶ Add a field and possibly a foreign key to a table specification that reference the table for the given
Dimension
.Parameters: - tableSpec :
ddl.TableSpec
Specification the field and foreign key are to be added to.
- dimension :
Dimension
Dimension to be referenced. If this dimension has required dependencies, those must have already been added to the table. A field will be added that correspond to this dimension’s primary key, and a foreign key constraint will be added only if the dimension is associated with a table of its own.
- primaryKey :
bool
If
True
, the new field will be added as part of a compound primary key for the table.- nullable :
bool
, optional If
False
(default) the new field will be added with a NOT NULL constraint.
Returns: - fieldSpec :
ddl.FieldSpec
Specification for the field just added.
- tableSpec :