Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Mapped datetime values are now typed as date-time strings in the schema message #2665

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion singer_sdk/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def _eval(

return result

def _eval_type(
def _eval_type( # noqa: PLR0911
self,
expr: str,
default: th.JSONTypeHelper | None = None,
Expand Down Expand Up @@ -398,6 +398,12 @@ def _eval_type(
if expr.startswith("bool("):
return th.BooleanType()

if expr.startswith("datetime.date") or expr.endswith(".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
Expand Down
Loading