static_analysis
The static_analysis config is available in the dbt Fusion Engine only. It isn't available in dbt Core and will be ignored. To upgrade to Fusion, refer to Install Fusion.
- Project file
- Property file
- SQL config
models:
resource-path:
+static_analysis: on | unsafe | off
models:
- name: model_name
config:
static_analysis: on | unsafe | off
{{ config(static_analysis='on' | 'unsafe' | 'off') }}
select
user_id,
my_cool_udf(ip_address) as cleaned_ip
from {{ ref('my_model') }}
Definition
You can configure if and when the dbt Fusion Engine performs static SQL analysis for a model. Configure the static_analysis config in your dbt_project.yml file, model YAML file, or in the config block of your model file. Refer to rendering strategies for more information on how the dbt Fusion Engine renders models.
The following values are available for static_analysis:
on: Statically analyze SQL ahead-of-time (AOT). Default for non-introspective models, depends on AOT rendering.unsafe: Statically analyze SQL just-in-time (JIT). The default for when a model (or any of its parents) uses introspective queries. JIT analysis still catches most SQL errors, but analysis happens after some upstream execution.off: Skip SQL analysis for this model and its descendants.
A model is only eligible for static analysis if all of its parents are also eligible.
Refer to the Fusion concepts page for deeper discussion and visuals: New concepts. For more info on the JSON schema, refer to the dbt-jsonschema file.
CLI override
You can override model-level configuration for a run using the following CLI flags. For example, to disable static analysis for a run:
dbt run --static-analysis off # disable static analysis for all models
dbt run --static-analysis unsafe # use JIT analysis for all models
Examples
The following examples show how to disable static analysis for all models in a package, for a single model, and for a model that uses a custom UDF.
- Disable static analysis for all models in a package
- Disable static analysis in YAML for a single model
- Disable static analysis in SQL for a model using a custom UDF
Disable static analysis for all models in a package
This example shows how to disable static analysis for all models in a package. The + prefix applies the config to all models in the package.
name: jaffle_shop
models:
jaffle_shop:
marts:
+materialized: table
a_package_with_introspective_queries:
+static_analysis: off
Disable static analysis in YAML for a single model
This example shows how to disable static analysis for a single model in YAML.
models:
- name: model_with_static_analysis_off
config:
static_analysis: off
Disable static analysis in SQL for a model using a custom UDF
This example shows how to disable static analysis for a model using a custom user-defined function (UDF) in a SQL file.
{{ config(static_analysis='off') }}
select
user_id,
my_cool_udf(ip_address) as cleaned_ip
from {{ ref('my_model') }}
Considerations
- Disabling static analysis means that features of the VS Code extension that depend on SQL comprehension will be unavailable.
- Static analysis might fail in some cases (for example, dynamic SQL constructs or unrecognized UDFs) and may require setting
static_analysis: off. For more examples, refer to When should I turn static analysis off?.
Was this page helpful?
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.