Skip to content

Commit

Permalink
updated wonky handling of iso dates in fromisoformat in versions less…
Browse files Browse the repository at this point in the history
… than 3.11
  • Loading branch information
kharigardner committed Mar 4, 2024
1 parent 360e271 commit 9e24101
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
29 changes: 28 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pyfivetran/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from __future__ import annotations # for | union syntax

from logging import getLogger
from dateutil.parser import isoparse
import datetime as dt
import sys


logger = getLogger(__name__)
Expand All @@ -14,6 +16,8 @@ def deserialize_timestamp(dt_str: str) -> dt.datetime:
:param dt_str: The timestamp to deserialize
:return: The deserialized timestamp
"""
if sys.version_info.minor < 11:
return isoparse(dt_str)
return dt.datetime.fromisoformat(dt_str)


Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ python = "^3.8, <3.12"
httpx = "^0.25.1"
lazy = "^1.6"
pytz = "^2024.1"
python-dateutil = "^2.9.0.post0"


[tool.poetry.group.dev.dependencies]
Expand Down

0 comments on commit 9e24101

Please sign in to comment.