Repository navigation
Data Type: NUMERIC #652
Description
Activity
It is probably still the right choice to serialize Decimal values as strings, because there is no other way to marshal them through JSON?
crate-python/src/crate/client/http.py
Lines 95 to 96 in 8a3bf38
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?
If we have the same behavior that we encountered here: crate/crate#16843
I agree to go with strings.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?
As you advise that HTTP/JSON transport may loose precision, may I ask if it would be expectably different when using the PostgreSQL interface?
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.
and to be more precise, http streams the full number (reaches the client), but the
application/jsonMIME type directive is the one that truncates digits.As CrateDB supports
NUMERIC/DECIMALtypes for quite some time (only the support to store numeric values was added recently), I wonder what this issue is about, what is missing?Probably we want to change the related test case to use a
NUMERICcolumn data type in the table definition.Reacted by Andreas MotlClosing this as superseded by #826 new ticket explains the problem precisely with reproduction, root cause, and a concrete proposed fix.
About
CrateDB gained a new data type NUMERIC. Most probably, we want to support it here in one way or another.
References
NUMERICsqlalchemy-cratedb#163Decimalvalues meltano-target-cratedb#52