Skip to content

Commit

Permalink
Adjust CrateJsonEncoder to cast Decimal values to Python float types
Browse files Browse the repository at this point in the history
Beforehand, they have been marshalled to Python `str` type.
  • Loading branch information
amotl committed Jan 16, 2024
1 parent 1f9b9de commit 2244d4b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/crate/client/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ class CrateJsonEncoder(json.JSONEncoder):
epoch_naive = datetime(1970, 1, 1)

def default(self, o):
if isinstance(o, (Decimal, UUID)):
if isinstance(o, (Decimal,)):
return float(o)
if isinstance(o, (UUID,)):
return str(o)
if isinstance(o, datetime):
if o.tzinfo is not None:
Expand Down

0 comments on commit 2244d4b

Please sign in to comment.