Skip to content

Commit

Permalink
Validate date type in processors
Browse files Browse the repository at this point in the history
  • Loading branch information
Aymaru authored and amotl committed Jul 18, 2022
1 parent 9a24409 commit c364c4a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/crate/client/sqlalchemy/dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def result_processor(self, dialect, coltype):
def process(value):
if not value:
return
if isinstance(value, datetime):
return value.date()
try:
return datetime.utcfromtimestamp(value / 1e3).date()
except TypeError:
Expand Down Expand Up @@ -128,6 +130,8 @@ def result_processor(self, dialect, coltype):
def process(value):
if not value:
return
if isinstance(value, datetime):
return value
try:
return datetime.utcfromtimestamp(value / 1e3)
except TypeError:
Expand Down

0 comments on commit c364c4a

Please sign in to comment.