How can I tell if --full-refresh is set on a materialization macro?


I’m trying to create a new materialization macro dbt docs - Creating new materializations.

From within the macro I want to check if I’m on a full_refresh or not.

I thought I could just model['config'].get('full_refresh') but it does seem to work when full_refresh is set via dbt run --full-refresh .

If I get explicity full_refresh on the model config with


then model['config'].get('full_refresh') works.

So how do I know for sure if I’m on a full-refresh or not?

Apparently there is two macros to check should_full_refresh() and is_incremental() that can be used to check if full-refresh is on effect.

There is also flags.FULL_REFRESH.

But I guess should_full_refresh() is the most appropiate one.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.