You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs-new/pages/reference/errors.mdx
+35-1Lines changed: 35 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,4 +22,38 @@ on your cubes to hide them from end users.
22
22
23
23
If you’re building a custom data application, you might use the [`meta` endpoint](/reference/rest-api#v1meta)
24
24
of the REST API. It groups cubes into `connectedComponents` to help select those ones
25
-
that can be joined together.
25
+
that can be joined together.
26
+
27
+
## `Primary key is required when join is defined`
28
+
29
+
```
30
+
cube_a cube: primary key for 'cube_a' is required when join is defined
31
+
in order to make aggregates work properly
32
+
```
33
+
34
+
Error message above indicates that you have a [cube](/product/data-modeling/reference/cube)
35
+
with [joins](/product/data-modeling/reference/joins) and
36
+
[pre-aggregations](/product/data-modeling/reference/pre-aggregations). However, that cube
37
+
doesn't have a primary key.
38
+
39
+
When generating SQL queries, Cube uses primary keys to avoid fanouts.
40
+
A fanout happens when two tables are joined and a single value gets duplicated in the end result,
41
+
meaning that some values can be double counted.
42
+
43
+
**Please define a [primary key](/product/data-modeling/reference/dimensions#primary_key) dimension in this cube to make joins and pre-aggregations work correctly.**
44
+
45
+
If your data doesn't have a natural primary key, e.g., `id`, you can define a composite
46
+
primary key by concatenating most or all of the columns in the table, e.g.:
0 commit comments