Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cubejs-client-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ class CubeApi {
query,
signal: options?.signal
}),
(response: any) => (Array.isArray(response) ? response.map((body) => new SqlQuery(body)) : new SqlQuery(response)),
Copy link
Member

@KSDaemon KSDaemon Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, I think it would be better to fix the original place that was changed. Because this changes the semantics.

    return this.sqlQuery.sql;
  }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted this change and implemented the fix in SqlQuery.ts file. Introduced this type SqlQueryWrapper = { sql: SqlData }; and changed the constructor argument and private sqlQuery variable type to SqlQueryWrapper instead of SqlData.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Thnx!
Btw, have you tested it locally?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested by generating the dev Docker image, and the SQL Generated Tab appears to be working afterwards. I’m not entirely sure how to run all the tests locally or if there are any tests covering this class. I’ll check the tests and add some if they don’t already exist.
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be just awesome! I think we can add unit tests for this class for the future!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit tests added for SqlQuery.ts

(response: any) => (Array.isArray(response) ? response.map((body) => new SqlQuery(body.sql)) : new SqlQuery(response.sql)),
options,
callback
);
Expand Down
Loading