Understand table relationships
Use a relationship to work out how one record refers to another. For example, an order can carry the identifier of the user who placed it. Knowing that key is necessary before joining the records or deciding what a deletion might affect.
Graph displays the relationships exposed by the source. In relational databases, these generally come from declared foreign keys.
Read both sides#
In the demo schema, an order's user_id refers to a user's id. Several orders can refer to the same user, which gives the relationship its one-to-many shape.
Related table nodes in Graph
Related table nodes in Graph
Inspect the fields on both objects and confirm the actual constraint in Info or the source's metadata. A field's name alone is not enough to establish that it references the key you expect.
For a PostgreSQL read of the demo data, you could verify the relationship with:
SQL
SELECT o.id AS order_id, u.id AS user_id, u.username
FROM test_schema.orders AS o
JOIN test_schema.users AS u ON u.id = o.user_id
ORDER BY o.id;
Use your own object names and source syntax. Check whether a different join type is needed when records without a match should remain in the result.
Follow more than one relationship#
An order can relate to a user, several order items, and payments. Those relationships answer different questions. Add only the objects needed for the current investigation so you can follow the intended path.
A table participating in several relationships
A table participating in several relationships
Before counting records after a join, check whether a relationship multiplies rows. One order joined to three items produces three joined records even though it is still one order.
When an edge is absent#
A missing edge can mean the database has no declared foreign key, the connector does not expose that relationship, or an object is outside the current graph selection. Graph does not infer a relationship just because two columns have similar names.
Inspect Info and the database metadata, then test the proposed join with a few known records. If the application needs a new constraint, maintain it through your normal schema migration process. Drawing or selecting a node does not create a database relationship.
Was this page helpful?