Added serialization for Decimal. The postgres provider converts number field to decimal.Decimal. (#274)

This commit is contained in:
Mary Bucknell
2019-10-14 16:54:52 -05:00
committed by Tom Kralidis
parent 7e9b2c49bf
commit 3cc335ee2c
+3
View File
@@ -30,6 +30,7 @@
"""Generic util functions used in the code"""
from datetime import date, datetime, time
from decimal import Decimal
import logging
import yaml
@@ -101,6 +102,8 @@ def json_serial(obj):
if isinstance(obj, (datetime, date, time)):
serial = obj.isoformat()
return serial
elif isinstance(obj, Decimal):
return float(obj)
msg = '{} type {} not serializable'.format(obj, type(obj))
LOGGER.error(msg)