-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Description
Hey, I am using jinja with dbt and would like to prefix a list of columns in a functional way.
I am trying
{% set columns = ["title", "name"] | map("format", "prefix_%s") | join(",") %}
Unfortunately this does not work because format
is not designed to be used with map
.
Map passes the variables in the "wrong" order:
def func(item: t.Any) -> t.Any:
return context.environment.call_filter(
name, item, args, kwargs, context=context
)
format
uses this syntax:
{{ item % args }}
# Example
{{ "Hello, %s!" % name }}
but to work with map it should be something like this:
{{ args % item }}
It would be nice to have it, even though its just syntactic sugar
Metadata
Metadata
Assignees
Labels
No labels