Skip to main content

to

Definition

A relationship is always between the outer class where it is defined and another class, specified in the property to.

For example, the relationship lives_in goes from person to a country.

Usage

Let's say we have the following tables: PERSON(id, name, country_id) and COUNTRY(id, name).

In this case the relationship lives_in is going to be defined inside kb.Person and contains the property to: kb.Country.

import: [
db.postgres.world.public.PERSON
]

kb {

class Person {
name.en: "Person"
sql: "${PERSON.id}"

relationship lives_in {
display_name: "lives in"
to: kb.Country

sql: "${PERSON.country_id}"
}

...
}
}