ForeignKey
Bases: Component
Syntax of Foreign Keys in Class Definitions
ForeignKey name(key_props) References referenced_class(ref_index) [ Keywords ];
key_props = field(default_factory=list)
Specifies the property or properties that are constrained by this foreign key.
Specifically this property or properties must match the referenced value in the foreign table.
At least one property required.
keywords = field(default_factory=dict, kw_only=True)
Foreign Key Syntax and Keywords
Optional dict used to specify keywords for this component.
Use {"Keyword": None}
for keywords that do not have a value
Valid Foreign Key keywords
- Internal – Specifies whether this foreign key definition is internal (not displayed in the class documentation).
- NoCheck – Specifies whether InterSystems IRIS should check this foreign key constraint.
- OnDelete – Specifies the action that this foreign key should cause in the current table when a record deleted in the foreign table is referenced by a record in the current table.
- OnUpdate – Specifies the action that this foreign key should cause in the current table when the key value of a record in the foreign table is updated and that record is referenced by a record in the current table.
- SqlName – Specifies an SQL alias for the foreign key.
ref_index = None
Optional property which specifies the unique index name within referenced_class
.
If you omit ref_index
, then the system uses the IDKEY
index in referenced_class
.
referenced_class
Required property, specifies the foreign table (that is, the class to which the foreign key points).