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

Add LiteralValue wrapper rendered without templating #35017

Merged
merged 11 commits into from Nov 17, 2023

Conversation

michalsosn
Copy link
Contributor

Closes: #33694

The PR introduces the airflow.template.templater.LiteralValue class, which wraps a single value and makes the Templater immediately return, bypassing Jinja templating for the content.

This class allows you to use strings that include Jinja macros or recognized file extensions as-is, without the need to modify the Operator by altering its template_fields or template_ext.

In cases where a field contains a complex object, it also enables you to selectively disable rendering for a portion of the object. This level of granularity is not achievable by overriding the template_fields.

Additionally, it provides a cleaner approach to avoid rendering files, in contrast to the documented method of leaving a trailing space within the string.


^ 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 newsfragments.

@Taragolis Taragolis added the type:new-feature Changelog: New Features label Oct 18, 2023
@Taragolis Taragolis added this to the Airflow 2.8.0 milestone Oct 18, 2023
@michalsosn michalsosn force-pushed the 33694-LiteralValue-templater branch 2 times, most recently from 5ab5b11 to ac98c8f Compare October 23, 2023 00:06
airflow/utils/template.py Outdated Show resolved Hide resolved
@potiuk potiuk force-pushed the 33694-LiteralValue-templater branch from ce3b014 to 90944f5 Compare November 17, 2023 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

airflow jinja template render error
4 participants