How to pass target.name or target.project values as an input to macro while calling from model.

{%- if target.name == “development” -%} {% set event_date = get_max_value( ‘{{ target.dataset }}’, ‘{{ target.table }}’, ‘session_date’) %}

Now string is only accepted as macro input while calling the macro. but when i complie the target.dataset or target.table are not getting populated when its invoked from model.

Hi @karrajan,

target variable belongs to the global scope, so you should be able to reference it without declaring it in macro.

Check this example of how to use it within jinja

The problem could be that you use double curly brackets.

1 Like