-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Glad to submit a PR for this to close out this issue, but just wanted to submit problem details I just discovered while walking through the tutorial here: https://cube.dev/docs/product/getting-started/cloud/create-data-model
Problem Details
USER_ID is used in the CREATE TABLE statement, but not in COPY INTO (see lines 80 & 94)
cube/docs/docs-new/pages/product/getting-started/cloud/load-data.mdx
Lines 77 to 89 in 7aaffd5
| ```sql | |
| CREATE TABLE cube_demo.ecom.users | |
| ( id INTEGER, | |
| user_id INTEGER, | |
| city VARCHAR, | |
| age INTEGER, | |
| gender VARCHAR, | |
| state VARCHAR, | |
| first_name VARCHAR, | |
| last_name VARCHAR, | |
| created_at TIMESTAMP | |
| ); | |
| ``` |
| COPY INTO cube_demo.ecom.users (id, city, age, gender, state, first_name, last_name, created_at) |
YAML should reference {users}.ID instead of {users}.USER_ID (lines 66 & 140)
cube/docs/docs-new/pages/product/getting-started/cloud/create-data-model.mdx
Lines 60 to 67 in 7aaffd5
| cubes: | |
| - name: orders | |
| sql_table: ECOM.ORDERS | |
| joins: | |
| - name: users | |
| sql: "{CUBE}.USER_ID = {users}.USER_ID" | |
| relationship: many_to_one |
cube/docs/docs-new/pages/product/getting-started/cloud/create-data-model.mdx
Lines 134 to 141 in 7aaffd5
| cubes: | |
| - name: orders | |
| sql_table: ECOM.ORDERS | |
| joins: | |
| - name: users | |
| sql: "{CUBE}.USER_ID = {users}.USER_ID" | |
| relationship: many_to_one |
Additional Info
Ran this query after importing data from AWS S3 bucket as laid out in the tutorial:
SELECT
'JOIN ON USERS.ID' as LABEL,
SUM(IFF("users".ID IS NULL, 1, 0)) as NUM_NULL,
COUNT(*) as NUM_RECORDS
FROM CUBE_DEMO_ECOM.ORDERS AS "orders"
LEFT JOIN CUBE_DEMO_ECOM.USERS AS "users"
ON "orders".USER_ID = "users".ID
UNION ALL
SELECT
'JOIN ON USERS.USER_ID' as LABEL,
SUM(IFF("users".USER_ID IS NULL, 1, 0)) as NUM_NULL,
COUNT(*) as NUM_RECORDS
FROM CUBE_DEMO_ECOM.ORDERS AS "orders"
LEFT JOIN CUBE_DEMO_ECOM.USERS AS "users"
ON "orders".USER_ID = "users".USER_IDResults:
| LABEL | NUM_NOT_NULL | NUM_RECORDS |
|---|---|---|
| JOIN ON USERS.ID | 10000 | 10000 |
| JOIN ON USERS.USER_ID | 0 | 10000 |