Skip to main content

Python model configurations

Use dbt.config() to set configs for a Python model. This page lists the parameters needed. For how to write a Python model, refer to Python models.

Literal values only

dbt.config() only accepts literal values (strings, booleans, and numbers). For anything more complex, set the config in a properties YAML file. Refer to Configuring Python models.

Common parameters​

The following parameters work on every platform that supports Python models.

ParameterTypeDescription
materialized<string>How dbt builds the model, such as table or incremental. Python models don't support view.
tags<list>Tags to apply to the model.
meta<dictionary>Custom metadata. Read it with dbt.config.meta_get().
packages<list>Packages to install, with optional version pins such as numpy==1.23.1. Required on some platforms. Refer to Configuring packages.

Read any config back inside your model with dbt.config.get().

Platform-specific parameters​

ParameterTypeDefaultDescription
python_version<string>3.10Python version the Snowpark model runs on.
packages<list>[]Anaconda packages to install when the model runs. dbt always adds snowflake-snowpark-python.
imports<list>[]Staged files, such as zip files, to make available to your model. Refer to Third-party Snowflake packages.
external_access_integrations<list>[]Snowflake external access integrations that let your model reach external APIs.
secrets<dictionary>{}Maps a variable name in your code to a Snowflake secret. Use it with external_access_integrations.
use_anonymous_sproc<boolean>TrueWhen True, dbt runs your model as an anonymous stored procedure. When False, dbt creates a named procedure (<model_name>__dbt_sp), calls it, then drops it.

For more details and a more comprehensive list, refer to Snowflake configurations.

Was this page helpful?

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

0
Loading