DBT Macro With Parameter IF statement eval

Viewed 19

I am trying to create a sql template using a macro with one parameter, the if condition does not evaluate to true when passed TABLE1 or TABLE2

{% macro cloud_test_results_get_standard_columns(modelName) %}
result,
Length,
estimatedLength as estimatedLength,
{% if ‘{{modelName}}’ == ‘TABLE1’ %}
    TABL1_COL1,
    TABL1_COL1,
    TABL1_COL1,
{% elif ‘{{modelName}}’ == ‘TABLE2’ %}
    TABL1_COL1,
    TABL1_COL1,
    TABL1_COL1,
{% else %}
    TABL_DEFAULT1,
    TABL_DEFAULT2,
    TABL_DEFAULT3,
{% endif %}
{% endmacro %}
1 Answers

please disregard, had to use modelName instead of ‘{{modelName}}’ inside if block

Related