diff --git a/poetry.lock b/poetry.lock index 1324fa8..719d2c3 100644 --- a/poetry.lock +++ b/poetry.lock @@ -874,6 +874,21 @@ pytest = ">=5.0" [package.extras] dev = ["pre-commit", "pytest-asyncio", "tox"] +[[package]] +name = "python-dateutil" +version = "2.9.0.post0" +description = "Extensions to the standard Python datetime module" +category = "main" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" +files = [ + {file = "python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3"}, + {file = "python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427"}, +] + +[package.dependencies] +six = ">=1.5" + [[package]] name = "pytz" version = "2024.1" @@ -1044,6 +1059,18 @@ files = [ {file = "shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de"}, ] +[[package]] +name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +files = [ + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, +] + [[package]] name = "sniffio" version = "1.3.0" @@ -1364,4 +1391,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.8, <3.12" -content-hash = "f6db2884c7fb21a7501c40e2146f7a017b37b6a9082cf11cc6fdf3c6b2cf661d" +content-hash = "95f8011704d6648ed771fb05d87c2865d79f347cab052c1b20ab70f38681c431" diff --git a/pyfivetran/utils.py b/pyfivetran/utils.py index f5b8ee6..d80a6f0 100644 --- a/pyfivetran/utils.py +++ b/pyfivetran/utils.py @@ -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__) @@ -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) diff --git a/pyproject.toml b/pyproject.toml index 193c84d..891a54f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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]