Skip to content

GNNTable.validate_table()

Helper method that performs various tests to validate metadata. Checks:

  • If there are any unmapped or unused columns.
  • If the table has at least one candidate key or one foreign key.

Raises ValueError if no candidate or foreign keys are present, or if a foreign key is set as a time column or if a candidate key is set as a time column.

from relationalai_gnns import GNNTable, ForeignKey
table_with_foreign_keys = GNNTable(
connector=connector,
name="TableWithFKeys",
source="DATABASE.SCHEMA.TABLE_WITH_FKEYS",
type="node",
foreign_keys=[ForeignKey(column_name="Id1", link_to="TableWithCKey1.Id1"),
ForeignKey(column_name="Id2", link_to="TableWithCKey2.Id2")]
)
table_with_foreign_keys.validate_table()