Skip to content

Commit

Permalink
DateColumn.before_write_item isinstance check
Browse files Browse the repository at this point in the history
  • Loading branch information
xzkostyan committed Apr 13, 2019
1 parent 8a69cbf commit 4e5a74e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion clickhouse_driver/columns/datecolumn.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ class DateColumn(FormatColumn):
epoch_end = date(2105, 1, 1)

def before_write_item(self, value):
value = date(value.year, value.month, value.day)
if type(value) != date:
value = date(value.year, value.month, value.day)

diff = (value - self.epoch_start).days
if value > self.epoch_end or diff < 0:
return 0
Expand Down

0 comments on commit 4e5a74e

Please sign in to comment.