flags

The flags variable contains values of flags provided on the command line.

Example usage:

flags.sql
{% if flags.FULL_REFRESH %}drop table ...{% else %}-- no-op{% endif %}

The list of available flags is defined in the flags module within dbt-core.

Recommended use cases include:

• different materialization logic based on "run modes," such as flags.FULL_REFRESH and flags.STORE_FAILURES
• running hooks conditionally based on the current command / task type, via flags.WHICH

Note: It is not recommended to use flags as an input to parse-time configurations, properties, or dependencies (ref + source). Flags are likely to change in every invocation of dbt, and their parsed values will become stale (and yield incorrect results) in subsequent invocations that have partial parsing enabled. For more details, see the docs on parsing.