From 6ac89184e8998e4bf09b2c50418e0f35d982410a Mon Sep 17 00:00:00 2001 From: Greg Koutsimpogiorgos Date: Wed, 4 Sep 2024 11:53:58 +0200 Subject: [PATCH 1/3] check for date and datetime in stream_maps --- singer_sdk/mapper.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/singer_sdk/mapper.py b/singer_sdk/mapper.py index a2e7bc956..eb9331f12 100644 --- a/singer_sdk/mapper.py +++ b/singer_sdk/mapper.py @@ -398,6 +398,12 @@ def _eval_type( if expr.startswith("bool("): return th.BooleanType() + if expr.startswith("datetime.date"): + return th.DateType() + + if expr.startswith("datetime.datetime"): + return th.DateTimeType() + return th.StringType() if expr[0] == "'" and expr[-1] == "'" else default def _init_functions_and_schema( # noqa: PLR0912, PLR0915, C901 From 4e09c9f4e57f1f39a48da435f31871fbcfbb0e89 Mon Sep 17 00:00:00 2001 From: Greg Koutsimpogiorgos Date: Wed, 4 Sep 2024 12:10:57 +0200 Subject: [PATCH 2/3] expr.endswith(".date()") --- singer_sdk/mapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/singer_sdk/mapper.py b/singer_sdk/mapper.py index eb9331f12..f50ea74a7 100644 --- a/singer_sdk/mapper.py +++ b/singer_sdk/mapper.py @@ -398,7 +398,7 @@ def _eval_type( if expr.startswith("bool("): return th.BooleanType() - if expr.startswith("datetime.date"): + if expr.startswith("datetime.date") or expr.endswith(".date()"): return th.DateType() if expr.startswith("datetime.datetime"): From 3281177878d5a044b809fa085b88ca6cd0291ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= <16805946+edgarrmondragon@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:42:22 -0600 Subject: [PATCH 3/3] Update mapper.py --- singer_sdk/mapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/singer_sdk/mapper.py b/singer_sdk/mapper.py index 4adc57f88..c222acc67 100644 --- a/singer_sdk/mapper.py +++ b/singer_sdk/mapper.py @@ -359,7 +359,7 @@ def _eval( return result - def _eval_type( + def _eval_type( # noqa: PLR0911 self, expr: str, default: th.JSONTypeHelper | None = None,