ForeignKey
Helper class for defining foreign keys of tables.
Parameters
Section titled “Parameters”| Name | Type | Description | Optional |
|---|---|---|---|
column_name | str | Name of the foreign key column. | No |
link_to | str | Table and column name that the foreign key links to, in the format TableName.ColumnName. ColumnName column must be defined as CandidateKey of the GNNTable TableName. | No |
is_feature | str | Indicates whether the foreign key is to be considered a Graph Neural Network (GNN) feature. Default is False. | Yes. |
Returns
Section titled “Returns”An instance of the ForeignKey class.
Example
Section titled “Example”from relationalai_gnns import GNNTable, ForeignKey
foreign_key_1 = ForeignKey(column_name="classId", link_to="Classes.classId")foreign_key_2 = ForeignKey(column_name="studentId", link_to="Students.studentId")
student_takes_class_table = GNNTable( connector=connector, name="StudentsTakeClass", source="SYNTH_DB.SYNTH_SCHEMA.STUDENTS_TAKE_CLASS", foreign_keys=[foreign_key_1, foreign_key_2])