<@ULVA73B9P> How can I scape {{ }} in prefect.yaml...
# ask-marvin
p
@Marvin How can I scape {{ }} in prefect.yaml? I am looking to include {{ variable_name }} as a part of a string in my workflow parameters and not having it parsed but didnt find a solution. Standard {% raw %}, {% endraw %} syntax also throws error
m
It seems there are currently no open issues on the Prefect GitHub repository that address the question of escaping curly braces (
{{ }}
) in
prefect.yaml
. To include
{{ variable_name }}
as a part of a string without having it parsed as a Jinja template in Prefect 2.x, you typically need to use escape sequences. In most templating contexts, you would double the curly braces to escape them, like this:
{{ "{{ variable_name }}" }}
. However, if this is not working and the standard Jinja
{% raw %}
and
{% endraw %}
syntax is throwing an error, then there's another method you can try. You can use a YAML multiline string, which may help in avoiding the template parsing:
Copy code
yaml
parameter:
  value: |
    {{ "{{ variable_name }}" }}
If none of these solutions work for your specific use case, it might require a deeper look into the Prefect documentation or reaching out to the Prefect community for advice. If you would like me to search Prefect's documentation for you, let me know!