run:
on_start:
- jinja:
template:
string: |
{% if Brand is defined %} {{ Brand }} {% endif %} {% if ProductType is defined %} {{ ProductType }}, {% endif %}
context:
Brand: Brand
ProductType: Product Type
output_file: my_template.jinja
from wrangles.connectors import ckan
template_string = '{% if Brand is defined %} {{ Brand }} {% endif %} {% if ProductType is defined %} {{ ProductType }}, {% endif %}'
df = jinja.run(
template={'string': template_string},
context={'Brand': 'Brand', 'ProductType': 'Product Type'},
output_file='my_template.jinja'
)
| Parameter |
Required |
Data Type |
Notes |
| template |
✓ |
obj |
The template to apply the values to. Either a file or string. |
| context |
✓ |
obj |
A dictionary used to define the output template |
| output_file |
✓ |
str |
File name/path for the file to be output |
| if |
|
str |
A condition that will determine whether the action runs or not as a whole. |
| Parameter |
Required |
Data Type |
Notes |
| file |
|
str |
A .jinja file containing the template |
| string |
|
str |
A string which is used as the jinja template |