Skip to content

Commit

Permalink
[QOLDEV-554] skip conversion if value already has the desired type
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrawnCA committed Aug 22, 2023
1 parent da8c602 commit 13d076f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ckanext/xloader/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,17 @@ def convert_types(self, extended_rows):


def to_number(value):
if isinstance(value, Decimal):
return value
try:
return Decimal(value)
except InvalidOperation:
return None


def to_timestamp(value):
if isinstance(value, datetime.datetime):
return value
try:
i = isoparser()
return i.isoparse(value)
Expand Down

0 comments on commit 13d076f

Please sign in to comment.