uranusjr commented on code in PR #64571:
URL: https://github.com/apache/airflow/pull/64571#discussion_r3160685346
##########
airflow-core/src/airflow/partition_mappers/temporal.py:
##########
@@ -144,6 +238,19 @@ def format(self, dt: datetime) -> str:
quarter = (dt.month - 1) // 3 + 1
return dt.strftime(self.output_format).format(quarter=quarter)
+ def decode_downstream(self, downstream_key: str) -> datetime:
+ # output_format carries a ``{quarter}`` placeholder, so strptime
doesn't
+ # apply directly. Locate ``YYYY...Q<digit>`` and rebuild the period
start.
+ match = self._YEAR_QUARTER_RE.search(downstream_key)
+ if match is None:
Review Comment:
Web frameworks e.g. Starlette and FastAPI (same underlying library) can
parse endpoints with `{name}` in them. Maybe we can look into how they do this
and combine it with strptime.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]