Foreign key ingestion

In a relational database, a foreign key is a field in one table that refers to the primary key of another table. The primary key is a table column, or combination of columns, to uniquely identify table records.

The table with the primary key is also referred to as referenced table or parent table, the table with the foreign key as child table.

Ingesting foreign keys

In Data Catalog, a foreign key will be ingested as an asset of the foreign key type. The foreign key asset creates relations between columns of different tables.

The foreign key asset consists of foreign key mappings between the parent and child table. In the following example, you see an overview of the tables, columns and a foreign key:

  • food: Schema that consists of two tables:
    • food_types: Table with the columns food_name, food_code and food_type.
    • fastfood: Table with the columns main_food_code, company_name and main_food_type.
  • fastfood_fk: Foreign key asset consists of one or more foreign key mappings.
    • mapping 1 (marked with blue arrows):
      • Constrains the column main_food_code from the child table.
      • References the column food_code from the parent table.
    • mapping 2:
      • Constrains the column main_food_type from the child table.
      • References the column food_type from the parent table.

For more information about the foreign key in Collibra, see the Foreign Key asset page.