Questions tagged [jinja2-cli]

jinja2-cli is a command-line tool for templating in shell-scripts, leveraging the Jinja2 library

jinja2-cli is a command-line tool for templating in shell-scripts, leveraging the Jinja2 library.

Features:

  • Jinja2 templating. Allows us to use environment variables!
23 questions
3
votes
2 answers

Jinja2 : Variable call impossible within markdown from two disticnt template using jinja2

I am using jinj2 inside markdown files to create a documentation template via Mkdocs. The whole process is created through a pipeline so I get to see what is done by the jinja2 code I write inside my templates, but there is that one particular…
Jinja_dude
  • 404
  • 5
  • 20
3
votes
1 answer

Create Multiple Tables in BigQuery Using dbt for-loop

I am trying to create individual tables inside a single dataset in BigQuery using a for-loop in dbt, going through a list of accounts, with no success so far. A little bit of context - I am using Stitch to fetch data from Facebook Ads and to push it…
Angel Dimov
  • 41
  • 1
  • 4
2
votes
1 answer

dbt incremental load merge operation without IS_INCREMENTAL() macro

I have set my model to be incremental by {{ config( materialized='incremental', unique_key='my_key', incremental_strategy='merge' ) }} Do I absolutely have to have IS_INCREMENTAL() macro at the end of the statement? If not, then…
PURWU
  • 397
  • 1
  • 8
  • 22
2
votes
0 answers

jinja2 error ModuleNotFoundError: No module named 'jinja2._compat'

Trying to upgrade jinja2 to the latest stable version Error according to the logs: ModuleNotFoundError: No module named 'jinja2._compat' Nothing related to this in the change logs https://jinja.palletsprojects.com/en/3.0.x/changes/#version-2-10 This…
Valhala
  • 21
  • 4
1
vote
1 answer

Trying to increment counter in Jinja2

I am trying to increment a counter variable to print the numbers one to six {% set counter = 1 %} {% for i in range(3) %} {% for j in range(2) %} {{ counter }} {% set counter = counter + 1 %} {% endfor %} {% endfor…
ryu.h
  • 11
  • 1
1
vote
1 answer

Jinja2 unescaping the sequence

I am working on a jinja2 template in python where autoescape=true flag is required due to privacy constraint. Since the autoescaping is enabled, jinja template ouputs the ascii value i.e >> instead of >> symbols. Is their a way where I can…
Himanshu
  • 21
  • 1
1
vote
1 answer

Condition based on the three first letters of a string?

In my Jinja template, model.DataType value can be user defined or built in. My requirenement is if model.DataType start with the three letters ARR, then do a specific operation. Example of…
alshamsh93
  • 29
  • 4
1
vote
1 answer

Jinja Template - list

Below are my input.yaml and my template.jinja: input.yaml: animals: my_pets: - species: name: "cat" age: "28" - species: name: "dog" age: "10" template.jinja {%- for pet in animals.my_pets %} Type: {{ pet.species.name…
Math
  • 43
  • 6
1
vote
1 answer

Variable usage in jinja2 inside markdown template

I am trying to create a template of a markdown file using jinja and the values of the variables are stocked in .yml file ( kind of an inventory of hosts). my problem is that I think that markdown table that I am trying to fill are not making it easy…
Jinja_dude
  • 404
  • 5
  • 20
1
vote
2 answers

How to omit an empty line after a for loop in Jinja?

I would like to generate the following output with the j2cli: // before function (arg1, arg2, arg3) // after I tried the following template: // before function ({% for param in ['arg1', 'arg2', 'arg3'] -%} …
ceving
  • 21,900
  • 13
  • 104
  • 178
1
vote
2 answers

Jinja2 template output parsing issue for comma

I have wrote the jinja2 template for ansible playbook. However, i dont want the comma at the end of last line for that reason, i have used the "if" condition with "loop.last". Since there is "for" loop and "if" loop, last line is executing two times…
learning fun
  • 519
  • 1
  • 5
  • 12
1
vote
0 answers

Assign json file to a variable inside loop jinja2 ansible

I am trying to assign a json file to a variable inside loop in ansible using --set-string and then run helm upgrade command. But it gives - This command needs 2 arguments: release name, chart path\nError: plugin \"tiller\" exited with error"…
supriya
  • 895
  • 1
  • 8
  • 18
0
votes
1 answer

Load json object from file (Jinja2)

I have a json file called values.json with different atributes: { "key1": "value1", "key2": "value2", "key3": "value3" } Using Jinja2, I am trying to import it and get just value1, but i don't find the way of doing it. I manage to…
pcampana
  • 2,413
  • 2
  • 21
  • 39
0
votes
1 answer

Use a python module in jinja template

trying to use subprocess python module to apply some commands if a dbt macro logic is not met macro: {% macro check_select_arg(run_all=False, dbt_command='dbt run') %} {% do log("ON START ✅", info=True) %} {% set subprocess = imprt( 'subprocess' )…
tangen14
  • 21
  • 3
0
votes
1 answer

Search a dictionary key and fetch it's values based on another list

I have a list like account_id_list = [1,2,3,4,5,6,7] I have a dictionary like tag_dict = [1:{"a"= "b", "y"= "z"}, 2:{"a"= "b", "y"= "z"}, 3:{"a"= "b", "y"= "z"}] I want to perform an operation in jinja2 such that i should be able to do a for loop on…
Yash Kamdar
  • 131
  • 6
1
2