Virtual relationships are used to link related entities based on a common attribute which helps in querying data and generating useful insights.
Consider entities that do not have relationships between them in the database. To derive insights from entities, we may need certain relationships in the data model while ensuring that the schema of the database remains the same.
To solve this problem, Astera Data Stack offers virtual relationships that help us create relationships between entities and leverage the benefits of relationships without forward engineering them to the database. Virtual relationships have similar characteristics as physical relationships, but they are not present in the database.
Consider an example where Customers and Orders tables are present in a database but are not connected with each other.
A virtual relationship could be created between the entities using a common attribute such as the CustomerID. Virtual relationships between two entities can be marked as virtual using any of the following steps
Right-click the relationship and select Virtual from the context menu.
Double-click the relationship to open the Edit Relationship window and mark the Virtual checkbox. Click OK to save the changes and close the window.
Open the Relationship Manager window either from the toolbar or using the short cut key, Ctrl + Shift+ E.
Now, select the relationship and mark the Virtual checkbox. Click OK to close the window.
A virtual relationship between the Customers and Orders entities has been created successfully. This virtual relationship will not show any changes when applying diff nor will it give any verification errors when verifying for Read and Write Deployment.