Skip to main content

Optimize static analysis for development and deployment

important

The dbt Fusion engine is currently available for installation in:

Join the conversation in our Community Slack channel #dbt-fusion-engine.

Read the Fusion Diaries for the latest updates.

Static analysis helps the dbt Fusion engine validate your SQL before it runs. This guide shows how to configure it so you get stronger checks while you develop, and faster, less blocking runs in deployment.

This guide explains why using strict in development and baseline (the default, lighter static analysis mode) in deployment is a valid and recommended pattern, and how to configure it in your Fusion project. For more information about modes and features, refer to About static analysis.

Why this pattern

  • Development: strict mode has the strongest SQL checks before you promote changes, including richer column-level features in the VS Code extension.
  • Deployment: baseline skips remote warehouse schema downloads and surfaces findings as warnings, so jobs are less likely to block. That can save compile time (and warehouse cost) in deployment, especially in projects with many sources. Review deployment logs for warnings that strict would have raised as errors in development.

strict can increase compile time because the dbt Fusion engine downloads schemas for all sources (including sources your models do not reference). Teams with thousands of sources have seen large differences between baseline and strict.

Set the mode with the CLI flag

Use the --static-analysis flag to set the mode for a single run.

Development:

dbt compile --static-analysis strict

Deployment:

dbt compile --static-analysis baseline

You can use the same flag with dbt run or dbt build. If you already have dbt Core or the platform CLI installed alongside Fusion, use dbtf as the unambiguous Fusion command.

You can also configure static_analysis per directory or model. Refer to Configuring static_analysis for examples.

Set the mode with an environment variable

You can also drive static_analysis from a custom environment variable in dbt_project.yml. This is useful when development and deployment share the same project config but set different environment values.

dbt_project.yml
models:
my_project:
+static_analysis: "{{ env_var('DBT_ENV_STATIC_ANALYSIS', 'baseline') }}"

Then set the variable per environment:

  • Development: DBT_ENV_STATIC_ANALYSIS=strict
  • Deployment: leave unset (defaults to baseline), or set DBT_ENV_STATIC_ANALYSIS=baseline

DBT_ENV_STATIC_ANALYSIS is a custom variable name you choose. It is separate from the built-in DBT_STATIC_ANALYSIS override used with the CLI flag.

For more information about env_var, refer to About env_var and Environment variables.

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

0
Loading