Introduction

By creating a schema in your project you allow all the users in that project to automatically join data from separate tables without writing code or specifying a join. The relationships defined in the schema will determine the type of join and the columns used.

How to edit the Schema

  1. In your Project, go to the Data tab
  2. Click Edit schema to open the schema editor

The Schema Explained

The schema is in JSON format and will detect if you've entered something in the incorrect format.

The structure is as follows:

{
"data_table1": {
"foreignKeys": [
{
"columns": ["my_unique_id"],
"table": "data_table2",
"joinType": "left"
}
],
"primaryKey": ["unique_row_identifier"]
},
"data_table2": {
"foreignKeys": [],
"primaryKey": ["unique_id"]
}
}

In the example above, there are 2 tables:

data_table1 and data_table2.

Primary Key

The unique columns (a.k.a. primaryKey) for each are:

  • data_table1: unique_row_identifier
  • data_table2: unqiue_id

Foreign Key

The foreign key of my_unique_id means that there is a column called my_unique_id in data_table1 that is linked to the unique_id column in data_table2.

Join Type

The joinType parameter determines the type of join used when merging data between data_table1 and data_table2.

The joinType parameter is optional and defaults to left.

The joinType options are: cross,full,inner,left,right

In that foreign key example, the SQL would look something like this:

SELECT ....
FROM data_table1
LEFT JOIN data_table2 on data_table1.my_unique_id = data_table2.unique_id
Did this answer your question?