Skip to content

Commit 6ba9766

Browse files
authored
Update Many-to-Many-Relationship.md
1 parent ca42022 commit 6ba9766

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/Guides/Many-to-Many-Relationship.md

+12
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ cube(`Post_Topic`, {
4444
};
4545
```
4646
47+
In case when a table doesn't have a primary key you can define it manually as follows
48+
49+
```javascript
50+
dimensions: {
51+
id: {
52+
sql: `CONCAT(${CUBE}.post_id, ${CUBE}.topic_id)`,
53+
type: `number`,
54+
primaryKey: true
55+
},
56+
}
57+
```
58+
4759
## Many-to-Many Relationship Without an Associative Table
4860
Sometimes there is no associative table in the database, when in reality, there is a many-to-many relationship. In this case, the solution is to extract some data from existing tables and create a virtual (not backed by a real table in the database) associative cube.
4961

0 commit comments

Comments
 (0)