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

Data Type: NUMERIC #652

Open
amotl opened this issue Oct 3, 2024 · 5 comments
Open

Data Type: NUMERIC #652

amotl opened this issue Oct 3, 2024 · 5 comments

Comments

@amotl
Copy link
Member

amotl commented Oct 3, 2024

About

CrateDB gained a new data type NUMERIC. Most probably, we want to support it here in one way or another.

References

@amotl
Copy link
Member Author

amotl commented Oct 31, 2024

It is probably still the right choice to serialize Decimal values as strings, because there is no other way to marshal them through JSON?

if isinstance(o, (Decimal, UUID)):
return str(o)

In this case, I guess it will be safe to close this issue for the DB API driver, but check crate/sqlalchemy-cratedb#163 instead, if there is something to do for SQLAlchemy, which is more likely?

/cc @matriv, @seut

@matriv
Copy link
Contributor

matriv commented Nov 1, 2024

If we have the same behavior that we encountered here: crate/crate#16843
I agree to go with strings.

@amotl
Copy link
Member Author

amotl commented Nov 6, 2024

Thank you. Then, there will be nothing to update or improve, other than the documentation perhaps, also on the Python driver at a relevant spot?

-- crate/crate#16843

As you advise that HTTP/JSON transport may loose precision, may I ask if it would be expectably different when using the PostgreSQL interface?

@seut
Copy link
Member

seut commented Nov 7, 2024

As you advise that HTTP/JSON transport may loose precision, may I ask if it would be expectably different when using the PostgreSQL interface?

Yes, the issue is completely related to HTTP/JSON only.

@matriv
Copy link
Contributor

matriv commented Nov 7, 2024

and to be more precise, http streams the full number (reaches the client), but the application/json MIME type directive is the one that truncates digits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants