Override DBT macro only in specific cases

I’m working on a project where I need to override the global macro default__snapshot_staging_table. I’ve successfully created this macro in my local workspace, and it’s functioning as expected. However, I want to maintain the default behavior of the macro under certain conditions.

{% macro default__snapshot_staging_table(some_args) %}
    {% if var('override') == true %}
        -- Use the overridden code
        -- My custom logic here
    {% else %}
        {{ super(some_args) }}  -- Call the default behavior
    {% endif %}
{% endmacro %}

Question

I’m looking for guidance on how to properly implement this in dbt. Specifically:

  • My approach to using super(some_args) is not working

Any insights or best practices would be greatly appreciated!