Foreign keys explained

Data Sources

We want to use the Activity and User tables together in a chart. To accomplish this, we’ll need to add a foreign key between the two tables to tell Chartio how to join the two tables together. We’ll join the User ID column in the Users table to the User ID column in the Activity table.

We’ll navigate to our data source’s Schema page via Settings > Data Sources > our data source > Schema tab.

First, let’s select the Activity table, and click the User ID column to edit it.

Activity Table

You’ll see a section labeled Foreign Key. From the first dropdown we’ll select the Users table, and then select User Id from the second dropdown. When finished, click Save to save your changes.

Foreign Key Selection

Chartio will now be able to auto-generate join paths between these two tables from Interactive Mode, using the User ID column to link them together.


Related Data Sources Help Articles

See more