-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Describe the bug
The Generated SQL tab in the playground is throwing an error in the UI. The API call does succeed but while rendering the SQL query, the UI breaks.
To Reproduce
Steps to reproduce the behavior:
- Build a valid query in the cube.dev playground
- Run the query to verify correct execution and results.
- Click on the Generated SQL tab
- See error
Expected behavior
The Generated SQL tab should show the query returned by the /sql API call instead of erroring out and breaking UI
Screenshots
Minimally reproducible Cube Schema
cube(`Orders`, {
sql: `
select 1 as id, 100 as amount, 'new' status
UNION ALL
select 2 as id, 200 as amount, 'new' status
UNION ALL
select 3 as id, 300 as amount, 'processed' status
UNION ALL
select 4 as id, 500 as amount, 'processed' status
UNION ALL
select 5 as id, 600 as amount, 'shipped' status
`,
measures: {
count: {
type: `count`,
},
totalAmount: {
sql: `amount`,
type: `sum`,
},
toRemove: {
type: `count`,
},
},
dimensions: {
status: {
sql: `status`,
type: `string`,
},
},
});
Version:
v1.3.16 - Generated SQL UI is working fine on previous versions e.g. 1.3.15
Additional context
I have investigated the reason for the issue, seems to be the latest commit replacing packages/cubejs-client-core/src/SqlQuery.js file with packages/cubejs-client-core/src/SqlQuery.ts. Happy to contribute with a PR.
packages/cubejs-client-core/src/SqlQuery.js:
rawQuery() {
return this.sqlQuery .sql;
}
packages/cubejs-client-core/src/SqlQuery.ts:
public rawQuery(): SqlData {
return this.sqlQuery;
}