Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent stringification of numerics between MySQL and ClickHouse drivers #9050

Open
mzealey opened this issue Dec 16, 2024 · 5 comments
Assignees
Labels
question The issue is a question. Please use Stack Overflow for questions.

Comments

@mzealey
Copy link

mzealey commented Dec 16, 2024

Describe the bug

When I run a query against ClickHouse, all numerics, measures etc get stringified.

When I run a query against MySQL, the measures at least don't get stringified in the response and are returned directly as JSON integers.

Expected behavior

Given the current docs, I would have expected all numeric responses to be stringified for all DB drivers (but actually I'd prefer it if something like #7118 were implemented)

Version:

Cube 1.1.9
Clickhouse 24.7
Mariadb 10.11.7

@igorlukanin igorlukanin self-assigned this Dec 18, 2024
@igorlukanin igorlukanin added the question The issue is a question. Please use Stack Overflow for questions. label Dec 18, 2024
@igorlukanin
Copy link
Member

actually I'd prefer it if something like #7118 were implemented

Hey @mzealey 👋 It is indeed already implemented. Please see castNumerics: https://cube.dev/docs/reference/frontend/cubejs-client-core#loadmethodoptions

@mzealey
Copy link
Author

mzealey commented Dec 18, 2024

Yes, however this is only on the javascript client side which we are not using.

@igorlukanin
Copy link
Member

@mzealey Would you be so kind to elaborate what you're using?

@mzealey
Copy link
Author

mzealey commented Jan 8, 2025

We're using Python/httpx to call the API directly. We're intending for this service to be used both from javascript but also various backend services (java, python etc). It seems to me that if the goal of cube is to standardize access to different data sources/queries, it would be great to have data types standardized on the API layer rather than the client layer?

@igorlukanin
Copy link
Member

I don't disagree with that, sure. One more workaround you can use while it is what it is: AFAIK, numeric values are always returned as strings when the query is served from a pre-aggregation. So if you have pre-aggregations in place, the issue will be non relevant to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question The issue is a question. Please use Stack Overflow for questions.
Projects
None yet
Development

No branches or pull requests

2 participants