Airflow RedshiftToS3Operator: using parameters

I’m tryng to pass parameters into my query sql using parameters parameter into a RedshiftToS3Operator. I don’t understand how to use my parameters into my query. Here is my query into a mycode.sql file: Select * From my_table where date_start = {{ data_interval_end.subtract(days=day_as_parameters)}} Using the Operator like this : unload_data_to_s3 = RedshiftToS3Operator( task_id="unload_data_to_s3", s3_bucket=S3_BUCKET, s3_key=S3_KEY,… Read More Airflow RedshiftToS3Operator: using parameters

is it possible to access JavaScript variables in Jinja?

How can I access javascript variables in the jinja template? Example: <script> let data_str = "video1"; let url = `{% url "renderVideo" args="${data_str}" %}` </script url: path("videoplay/<str:args>", views.videoplay, name="videoplay") Traceback: Internal Server Error: /videoplay/${data_str} I’m expecting /videoplay/video1 but it is not parsing the JavaScript variable. >Solution : TL;DR: No, Jinja and JS are separate processes.… Read More is it possible to access JavaScript variables in Jinja?

Stripping out Babel in Flask Jinja Template

I’m working with this tutorial which has the following lines: {% set user_link %} <span class="user_popup"> <a href="{{ url_for(‘main.user’, username=post.author.username) }}"> {{ post.author.username }} </a> </span> {% endset %} {{ _(‘%(username)s said %(when)s’, username=user_link, when=moment(post.timestamp).fromNow()) }} It looks this was specifically because he uses Babel translate, which he talks about on his blog. My question… Read More Stripping out Babel in Flask Jinja Template

How can set jinja variable in javascript function?

function show_modal(val1, val2){ {% set msg1 = val1 %} {% set msg2 = val2 %} document.getElementById(‘id01′).style.display=’block’ } I have calling show_modal() function in some where in the template. Needs each time assigning situational values to msg1 and msg2 Not working. Each not working below: function show_modal(){ {% set msg1 = "Delete Column" %} {% set… Read More How can set jinja variable in javascript function?

Difference of writing jinja2 macro in one line V.S. writing macro in multiple lines?

I have next jinja2 template: cfg.jinja2: {% macro cfg() %}ABC{% endmacro %} {% macro cfg2() %} ABC {% endmacro %} resource: {{ cfg()|indent(4) }} {{ cfg2()|indent(4) }} And, next python file: test.py: import os from jinja2 import Environment, FileSystemLoader path_dir = "." loader = FileSystemLoader(searchpath=path_dir) env = Environment(loader=loader) template = env.get_template("cfg.jinja2") data = template.render() print(data)… Read More Difference of writing jinja2 macro in one line V.S. writing macro in multiple lines?

Getting error when I am trying to put expression inside a jinja template

I want to put an expression such as "Host(`{{ .Name }}.access.{{website_tld}}`)"` inside my jinja2 template static_traefik.yml.j2 so that {{ .Name }} should stay as is but {{website_tld}} should get replaced when I am running ansible task. However this is throwing a massive error: "AnsibleError: template error while templating string: unexpected char ‘\\\\’ at 1016. consulCatalog:\n… Read More Getting error when I am trying to put expression inside a jinja template