How can I filter a list in jinja2 to generate a list of values from a lookup table? I have a situation where I am using Jinja2 to generate SQL. I have a list of values and I want to replace them with a list of transformed values based on a lookup: In my template, I want to be able
Tag: jinja2
How to add a Jinja function to .sqlfluff config
I’m using the jinja functions run_query and execute. https://docs.getdbt.com/reference/dbt-jinja-functions/run_query But when sqlfluff lint I get the following error: Undefined jinja template variable: ‘run_query’ I’m trying to add it to the .sqlfluff config but there doesn’t seem to be any guidance anywhere on how to add this to the config file. Any help would be greatly appreciated! Thanks Answer Add templater=dbt
dbt macro – using *args/**kwargs
Occasionally, our tables need to append multiple columns together to make a unique key. This can be done by doing something like: select *, col1 || “_” || col2 as unique_key from …
For loop in Jinja2 splitting the chars in nested list, instead of returning whole of nested list
My doubts list is [[‘a’,’b’,’This is a sentence’]] My HTML (Jinja) is My Flask is :- x is giving a,b,T,h,i,s,i,s,a,s,e,n,t,e,n,c,e [Each char one iteration] I expected a,b,This is a sentence. [Only one iteration] How do I resolve this? Thanks in advance! Answer You have dumped the output to json for some reason. Don’t do that. Pass the value of cursor.fetchall()
How to implement a search function using a raw SQL query
I am creating an app guided by CS50’s web series, which requires me to ONLY use raw SQL queries not ORM. I am trying to make a search function where a user can look up the list of books that’s …