Call a Macro with default values

The problem I’m having

I have a macro which has 5 parameter all having default values, I am trying to keep the first one default but pass the value for the second and third parameter. How will I call it?

The context of why I’m trying to do this

Macro:

{% macro calculate_refresh_date(partition_column = CURRENT_DATE(), where_column = none, where_condition = none, table_name = this, days_to_process = var(‘events_reprocess_days’) ) %}

What I’ve already tried

I have tried to call the macro by passing nothing in the first parameter but it gives syntax error:

{% set _max_ingested_at = calculate_refresh_date(, ‘tenant’, country) %}

Some example code or error messages

Put code inside backticks
  to preserve indentation
    which is especially important 
      for Python and YAML! 

Try calling the macro by including argument names,
like
{% set max_ingested_at=calculate_refresh_date(where_column='tenant', where_condition='country') %}

1 Like