kaxil commented on code in PR #67285:
URL: https://github.com/apache/airflow/pull/67285#discussion_r3321502844
##########
airflow-core/docs/authoring-and-scheduling/assets.rst:
##########
@@ -623,7 +623,9 @@ partition match can be produced, so the downstream Dag is
not triggered for
that key.
Inside partitioned Dag runs, access the resolved partition through
-``dag_run.partition_key``.
+``dag_run.partition_key``. For date-shaped partitions, the underlying
+``datetime`` is also available as ``dag_run.partition_date``, so
+templates can use ``{{ partition_date | ds }}``.
Review Comment:
This reads as if `partition_date` is populated for any date-shaped
partition, but it's only set for `IdentityMapper` and the `StartOf*Mapper`
family. `ProductMapper`, `ChainMapper`, `AllowedKeyMapper`, and custom mappers
leave it `None` (per `_compute_target_partition_date` in `assets/manager.py`).
The shipped `aggregate_regional_sales` example uses
`ProductMapper(IdentityMapper(), StartOfDayMapper())`, which produces a
date-shaped key but `partition_date` will be `None` there. Could we add a
sentence noting `partition_date` is only available for identity and `StartOf*`
mappers, so users of composite/custom mappers know to keep parsing
`partition_key`?
--
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]