Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion caravel/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from sqlalchemy.types import TypeDecorator, TEXT
from pydruid.utils.having import Having

EPOCH = datetime(1970, 1, 1)


class CaravelException(Exception):
pass
Expand Down Expand Up @@ -309,7 +311,7 @@ def json_int_dttm_ser(obj):
if val is not None:
return val
if isinstance(obj, datetime):
obj = int(time.mktime(obj.timetuple())) * 1000
obj = (obj - EPOCH).total_seconds() * 1000
else:
raise TypeError(
"Unserializable object {} of type {}".format(obj, type(obj))
Expand Down