Joins define how cubes connect to each other. When a view includes members from multiple cubes, Cube uses these relationships to automatically generate SQLDocumentation Index
Fetch the complete documentation index at: https://cubed3-igor-core-418-duplicate-view-definitions-break-deplo.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
JOIN clauses — so end-users can explore data
across tables without writing SQL.
See the joins reference for the full
list of parameters and configuration options.
Relationship types
Cube supports three relationship types:one_to_one, one_to_many, and
many_to_one. The relationship type determines which table becomes the left
side of the LEFT JOIN in the generated SQL.
Consider two cubes, orders and customers. An order belongs to one
customer, but a customer can have many orders:
many_to_one join on orders means: many orders belong to one customer.
When a view includes members from both cubes, Cube generates SQL with orders
on the left and customers on the right:
orders is on the left side of the LEFT JOIN, all orders are
preserved — including guest checkouts with no matching customer.
Many-to-many relationships
A many-to-many relationship requires an associative (junction) table. For example,posts and topics are connected through a post_topics table:
posts → post_topics → topics):
join_path:
Direction of joins
All joins are directed. They flow from the source cube (where the join is defined) to the target cube (the one referenced). Cube places the source cube on the left side of theLEFT JOIN and the target on the right.
This matters because the left table preserves all its rows, while the right
table contributes matching rows or NULL. The direction you choose affects
which records appear in the result set.
For example, if orders defines a many_to_one join to customers:
ordersis the base → all orders are preserved, even guest checkoutscustomerswithout orders won’t appear
customers defined a one_to_many join to orders:
customersis the base → all customers are preserved, even those without orders- Guest checkout orders (with no matching customer) won’t appear
Using views to control direction
Views let you control which join path is followed via thejoin_path parameter. This is the recommended way to
handle cases where you need different join directions for different use cases:
revenue_per_customer view follows the orders → customers path, so all
orders are preserved. The customer_activity view follows
customers → orders, so all customers are preserved.
Diamond subgraphs
A diamond subgraph occurs when there’s more than one join path between two cubes — for example,users.schools.countries and
users.employers.countries. This can lead to ambiguous query generation.
Views resolve this ambiguity by specifying the exact join_path for each
included cube. For example, if cube a joins to both b and c, and both
b and c join to d, a view can specify which path to follow:
Join paths in calculated members
When referencing a member of another cube in a calculated member, you can use a join path to specify the exact route. This uses dot-separated cube names:Troubleshooting
Can't find join path
The error Can't find join path to join 'cube_a', 'cube_b' means the cubes
included in a view or query can’t be connected through the defined joins.
Check that:
- Joins are defined with the correct direction
- There is a continuous path from the source cube to the target cube
- You’re using the
join_pathparameter in views to specify the exact path