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
- Go to the diagram of the model you want to create a relationship.
- Click the "+" icon next to the "Relationships" section.
- 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).
- Click "Save" to create.
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:
- Click the "..." icon next to the relationship on the model diagram.
- Choose "Edit".
- You can edit the Type of this relationship.
Delete a relationship
To delete a relationship:
- Click the "..." icon next to the relationship on the model diagram.
- Choose "Delete".
Relationship information
You can hover on the relationship line between model diagrams to see the information of specific relationship.
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.
If all changes have been deployed, navbar will show synced
message.