If you have specified the path to both a subject table and a linked table, the Edit relationship
screen shown below will appear. Here you can specify how these two tables are linked.
You can skip this step if you only entered the path to a subject table.

For subject table-event table datasets, you can only specify so-called one-to-many relationships. That is to say, an entry in the subject table can be associated with one or more entries in the event table. For example, each customer can have many shopping cart items. Or, each bank account can have many transactions.
MOSTLY AI establishes this relationship using a primary key
and a foreign key
:
-
The
primary key
refers to a column in your subject table that contains unique identifiers for your subjects. -
The
foreign key
is its counterpart in your other tables. You can use the identifiers in the subject table to link to rows in these tables.
The below image shows a usage example of these keys. The subject table players.csv
has a primary key called id
, and the event table has a foreign key called players_id
. The unique identifier 00020a493f3b
is marked in green. This identifier links the baseball player Jorge Lopez with his four events in the seasons.csv
table.
MOSTLY AI automatically links two tables if the subject table contains a column called id
and the second table contains _id
in the name of a column (for instance, players_id
).
You can also specify the primary and foreign keys using the drop-down menus in the table detail panes
Here, you can select any column from your subject table as your primary key and any column from your other table as your foreign key. Your choices are automatically saved.

If you specify an invalid link, then the run will fail during the encoding step. |