Skip to main content

Working with Relationships

Data model relationships refer to associations established between different models, specifying how data in one table relates to data in another table.
Relationships enable efficient querying and analysis of interconnected data.

Create a relationship

Create a relationship from connection process

During the connection process, you have the option to define relationships among selected tables as an additional step.

Create a relationship from the Modeling page

  1. Go to the diagram of the model you want to create a relationship.
  2. Click the "+" icon next to the "Relationships" section. rel_create1
  3. Define following properties in a relationship:
    • From: Select the left side table and column of this relationship.
    • To: Select the right side table and column of this relationship.
    • Type: Select the type of relationship (Many-to-one, One-to-many, One-to-one). rel_create2
  4. Click "Save" to create.
Relationship Limitations

When creating relationships between data models in Wren AI, the following situations are not allowed:

1. Self-Referential Relationship

A self-referential relationship is when a column within a model points back to the same model.

For example, in an Employee model, the reportsTo column may store the ID of another Employee, indicating the reporting structure within the organization.

Wren AI currently does not support creating such self-referential relationships, where a column in a model references the same model. This limitation prevents the direct modeling of hierarchical or recursive data structures within a single model.

2. Relationship Duplication

Wren AI does not permit the creation of duplicate relationships between the same pair of models using identical columns.

For instance, if a relationship already exists between the Order and Customer models using the customerID field, you cannot create another relationship using the same customerID field between these models.

This restriction ensures that each relationship remains unique, avoiding redundancy and potential confusion in model associations.

Update a relationship

To update relationship settings in a model:

  1. Click the "..." icon next to the relationship on the model diagram. rel_update
  2. Choose "Edit".
  3. You can edit the Type of this relationship. rel_update2

Delete a relationship

To delete a relationship:

  1. Click the "..." icon next to the relationship on the model diagram.
  2. Choose "Delete". rel_update

Relationship information

You can hover on the relationship line between model diagrams to see the information of specific relationship. rel_lines

Remember to deploy your changes

Deploy

Please esure you press the "Deploy" button on the Navbar to synchronize any modifications in the Modeling page with our Wren Engine.

If there are any new changes, navbar will show Undeployed changes message. undeployed

If all changes have been deployed, navbar will show synced message. deployed