Skip to content

Support templated extra in outlets assets - #54885

Merged
hussein-awala merged 3 commits into
apache:mainfrom
hussein-awala:template_asset_extra
Aug 25, 2025
Merged

hussein-awala merged 3 commits into
apache:mainfrom
hussein-awala:template_asset_extra

Conversation

@hussein-awala

Copy link
Copy Markdown
Member

This PR adds support for Jinja templates in outlet assets, which will be rendered in the emitted events.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@hussein-awala hussein-awala added type:new-feature Changelog: New Features and removed type:new-feature Changelog: New Features labels Aug 25, 2025

@Lee-W Lee-W left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one question, one nit. no major issue on my end

@vikramkoka

Copy link
Copy Markdown
Contributor

Not an issue, but a question: What's the intended use case here?

@hussein-awala

Copy link
Copy Markdown
Member Author

Not an issue, but a question: What's the intended use case here?

The asset can be used to connect two DAGs for two different teams. The owner of the dataset (the team who owns the producer task) is responsible for providing some metadata to the consumer DAG to explain what to process and how.

To simplify the answer, I can take a part of AIP-76 as an example. With this PR, the partition can be defined at runtime, since we can have backfills and runs created by external events, and the partition is not always known at parse time.

SomeOperator(
    task_id="write_asset",
    ...,
    outlets=Asset(
        "asset_example",
        extra={
            "partition": "{{ logical_date.strftime('%Y_%m_%d/%H') }}",
        }
    ),
)

Also, when the team owner of the dataset wants to change the partition pattern, there’s no need to notify the consumer side, as the dataset schema still respects the data contract.

@hussein-awala
hussein-awala merged commit 438b76c into apache:main Aug 25, 2025
uranusjr added a commit to astronomer/airflow that referenced this pull request Sep 3, 2025
hussein-awala pushed a commit that referenced this pull request Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants