-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
CDK: Add support for input format parsing at jinja macro format_datetime #40759
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
cristina.mariscal seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit. looks good
airbyte-cdk/python/pyproject.toml
Outdated
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" | |||
|
|||
[tool.poetry] | |||
name = "airbyte-cdk" | |||
version = "2.2.0" | |||
version = "2.2.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you shouldn't need to bump the version. the github action will take care of it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -107,7 +107,7 @@ def duration(datestring: str) -> Union[datetime.timedelta, isodate.Duration]: | |||
return parse_duration(datestring) # type: ignore # mypy thinks this returns Any for some reason | |||
|
|||
|
|||
def format_datetime(dt: Union[str, datetime.datetime], format: str) -> str: | |||
def format_datetime(dt: Union[str, datetime.datetime], format: str, input_format: str = None) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: input_format is an Optional[str]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for addressing the comments!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
APPROVED
@@ -107,7 +107,7 @@ def duration(datestring: str) -> Union[datetime.timedelta, isodate.Duration]: | |||
return parse_duration(datestring) # type: ignore # mypy thinks this returns Any for some reason | |||
|
|||
|
|||
def format_datetime(dt: Union[str, datetime.datetime], format: str) -> str: | |||
def format_datetime(dt: Union[str, datetime.datetime], format: str, input_format: Optional[str] = None) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are errors for this test:
==================================== ERRORS ====================================
_ ERROR collecting airbyte-cdk/python/unit_tests/sources/declarative/interpolation/test_macros.py _
airbyte-cdk/python/unit_tests/sources/declarative/interpolation/test_macros.py::test_format_datetime: in "parametrize" the number of names (4):
['test_name', 'input_value', 'format', 'expected_output']
must be equal to the number of values (5):
('test_datetime_string_to_date', '2022-01-01T01:01:01Z', '%Y-%m-%d', None, '2022-01-01')
=============================== warnings summary ===============================
airbyte_cdk/connector_builder/connector_builder_handler.py:28
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…m-airbyte/macros_dt_str
What
In order to support complex input datetime formats at low code, including input_format param to format_datetime macro, so it will allow us to parse any kind of datetime string, so it can be processed to standarized ISO (or any other format as required).
Review guide
Can this PR be safely reverted and rolled back?