Registry / data / dbt-snowflake

dbt-snowflake

JSON →
library1.12.0pypypi✓ verified 27d ago

dbt-snowflake is the official adapter plugin for dbt (data build tool), enabling users to define, manage, and run data transformations against a Snowflake data warehouse. It extends dbt-core with Snowflake-specific SQL dialect, connection management, and materialization strategies. Current version is 1.11.4, and it is typically released in lockstep with dbt-core major and minor versions, meaning a quarterly or bi-annual cadence.

pip install dbt-snowflake
INSTALL
IMPORT
SIG · DBT-SNOWFLAKE
D
dbt-snowflake
datapythonv1.12.0
Install
19.8s avg
Import
5010ms
Disk
203MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.12.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 19.8s · import 5.010s · 211MB
203MB installed
● package 203MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SnowflakeAdapter
from dbt.adapters.snowflake.impl import SnowflakeAdapter
Most end-users interact with dbt-snowflake via the dbt CLI; direct imports are typically for extending dbt's core functionality or advanced programmatic use cases.
SnowflakeConnectionManager
from dbt.adapters.snowflake.connections import SnowflakeConnectionManager
Primarily for extending dbt's connection handling or for custom tooling. Not for typical dbt project usage.

This Python script generates a minimal `profiles.yml` file in your `~/.dbt/` directory, configured for Snowflake using environment variables for credentials. After running this script, follow the printed instructions to initialize a dbt project, link it to the generated profile, and run `dbt debug` to verify your Snowflake connection. Remember to set the required Snowflake environment variables (e.g., `SNOWFLAKE_ACCOUNT`, `SNOWFLAKE_USER`, `SNOWFLAKE_PASSWORD`) or replace placeholders.

import os from pathlib import Path # Define minimal profiles.yml content using environment variables. # Make sure to set SNOWFLAKE_ACCOUNT, SNOWFLAKE_USER, SNOWFLAKE_PASSWORD, # SNOWFLAKE_ROLE, SNOWFLAKE_WAREHOUSE, SNOWFLAKE_DATABASE, SNOWFLAKE_SCHEMA # in your environment before running this, or replace the placeholders directly. profiles_yml_content = f""" dbt_snowflake_example: target: dev outputs: dev: type: snowflake account: {os.environ.get('SNOWFLAKE_ACCOUNT', 'your_account.snowflakecomputing.com')} user: {os.environ.get('SNOWFLAKE_USER', 'your_snowflake_user')} password: {os.environ.get('SNOWFLAKE_PASSWORD', 'your_snowflake_password')} role: {os.environ.get('SNOWFLAKE_ROLE', 'SYSADMIN')} warehouse: {os.environ.get('SNOWFLAKE_WAREHOUSE', 'COMPUTE_WH')} database: {os.environ.get('SNOWFLAKE_DATABASE', 'DBT_DEV_DB')} schema: {os.environ.get('SNOWFLAKE_SCHEMA', 'PUBLIC')} threads: 1 client_session_keep_alive: false """ # Ensure ~/.dbt directory exists and write profiles.yml dbt_dir = Path.home() / ".dbt" dbt_dir.mkdir(parents=True, exist_ok=True) profiles_yml_path = dbt_dir / "profiles.yml" with open(profiles_yml_path, "w") as f: f.write(profiles_yml_content) print(f"Generated a sample profiles.yml at: {profiles_yml_path}") print("\nNext steps:") print("1. Create a dbt project: `dbt init my_snowflake_project`") print("2. Update `my_snowflake_project/dbt_project.yml` to use `profile: dbt_snowflake_example`") print("3. Navigate into your project directory: `cd my_snowflake_project`") print("4. Verify your connection: `dbt debug`") print(" Ensure you have configured environment variables or replaced placeholders.") # Uncomment the following to directly run dbt debug if you have dbt-core installed # import subprocess # try: # print("\nAttempting to run 'dbt debug' to verify connection...") # # This assumes you have created 'my_snowflake_project' and updated its profile # # For a full quickstart, this requires more setup than a single snippet can provide. # # subprocess.run(["dbt", "debug", "--profile", "dbt_snowflake_example"], check=True) # # print("dbt debug completed successfully.") # except FileNotFoundError: # print("Error: 'dbt' command not found. Install dbt-core via `pip install dbt-core`.") # except subprocess.CalledProcessError as e: # print(f"Error during 'dbt debug': {e}") # print("Check your profiles.yml and Snowflake credentials.")
dbt --version
Debug
Known issues
breakingBreaking changes in `dbt-core`'s adapter interface frequently require corresponding updates in `dbt-snowflake`. Ensure your `dbt-snowflake` version is compatible with your `dbt-core` version (e.g., dbt-core 1.x requires dbt-snowflake 1.x).
fix
Always check the dbt-core release notes and upgrade `dbt-snowflake` in tandem with `dbt-core` using `pip install --upgrade dbt-core dbt-snowflake`.
affects: All versions when upgrading dbt-core major/minor versions (e.g., 0.x to 1.x, 1.0 to 1.1).
gotchaIncorrect or incomplete Snowflake profile configuration in `profiles.yml` is the most common issue. Pay close attention to `account`, `user`, `password` (or key pair), `role`, `warehouse`, `database`, and `schema`.
fix
Run `dbt debug` within your dbt project to diagnose connection issues. Verify all Snowflake connection parameters and ensure environment variables (if used) are correctly set.
affects: All versions
gotchaPython version compatibility. `dbt-core` and its adapters specify minimum Python versions. Using an unsupported Python version (e.g., a pre-release like 3.13) will often lead to installation or runtime errors. If no pre-built wheels are available for your Python version and operating system (especially on minimal environments like Alpine), installation may fail during source compilation if required build tools (like `g++`) are missing.
fix
Ensure your Python environment meets the `requires_python` specification for both `dbt-core` and `dbt-snowflake`. If installing on a minimal OS (e.g., Alpine Linux) or with a very new Python version for which pre-built wheels are not available, you may need to install development packages (e.g., `build-base` on Alpine or `python3-dev gcc` on Debian-based systems) or use a more stable Python version/OS combination.
affects: All versions, specifically when upgrading dbt-core/dbt-snowflake or using pre-release Python versions.
gotchaNetwork connectivity issues (firewalls, proxy settings, private link configurations) can prevent dbt-snowflake from connecting to Snowflake, even with correct credentials.
fix
Consult your IT team and Snowflake documentation for network requirements. Test connectivity outside dbt (e.g., using `snowsql` CLI or a simple Python `snowflake-connector-python` script).
affects: All versions
Errors
Common errors & fixes
Failed to connect to DB: <account_identifier>.snowflakecomputing.com:443. Incorrect username or password was specified.
This error indicates that dbt-snowflake could not establish a connection to your Snowflake account because the provided credentials (username or password) in your `profiles.yml` file are incorrect, the account identifier is wrong, or an OAuth token has expired.
fix
Double-check your `profiles.yml` for typos in `account`, `user`, and `password`. Ensure the Snowflake user's password has not changed or the OAuth connection has not expired; if using OAuth, reconnect your Snowflake account via dbt Cloud profile settings. Running `dbt debug` can help pinpoint connection issues.
SQL compilation error: Object '<object_name>' does not exist or not authorized.
This error occurs when dbt attempts to execute SQL against a Snowflake object (database, schema, table, view, etc.) that either does not exist, or the Snowflake user/role configured in `profiles.yml` does not have the necessary permissions to access it.
fix
Verify that the specified object (`<object_name>`) exists in Snowflake. Grant the appropriate `USAGE` and `SELECT` (or `CREATE`/`INSERT` for transformations) permissions to the Snowflake role used by dbt on the database, schema, and table/view. Check the compiled SQL in `target/compiled/` to see the exact query dbt is trying to run and ensure correct quoting of identifiers if they are case-sensitive.
Database Error 000606 (57P03): No active warehouse selected in the current session. Select an active warehouse with the 'use warehouse' command.
The Snowflake connection defined in your `profiles.yml` or the default role assigned to the user does not have a valid or accessible warehouse specified, or the `warehouse` parameter is missing or incorrect in your dbt profile, which is particularly common for `dbt seed` operations.
fix
Ensure that the `warehouse` parameter is correctly defined in your `profiles.yml` under the Snowflake target. Confirm that the Snowflake user/role specified in your profile has `USAGE` privilege on the specified warehouse, or manually set a default warehouse for the user in Snowflake via `ALTER USER <user_name> SET DEFAULT_WAREHOUSE = '<existing_warehouse_name>';`.
'NoneType' object has no attribute 'replace'
This Python error typically happens when a Jinja expression or Python logic within a dbt macro or model expects a string (or an object with a `.replace()` method) but receives a `None` value instead. This can occur if a variable is not initialized, a `ref()` or `source()` call returns no object, or a function doesn't return a value as expected.
fix
Review the Jinja or Python code where the error occurs and identify the variable or function call that is unexpectedly returning `None`. Ensure all variables are properly initialized, that `ref()` and `source()` calls point to existing, accessible models/sources, and that Python models correctly generate their output dataframe. For Jinja, add `{% if variable_name is not none %}` checks or use `default('')` to provide a fallback string.
Cannot perform CREATE TABLE. This session does not have a current schema. Call 'USE SCHEMA', or use a qualified name.
This Snowflake error indicates that a DDL operation (like `CREATE TABLE`) was attempted without an active schema in the session context, and the object name was not fully qualified with a database and schema. dbt sometimes encounters this when the default schema context is not correctly propagated or implicitly available, especially with dynamic tables or specific materialization strategies.
fix
Ensure your `profiles.yml` explicitly defines a `schema` parameter for your target. Review the model's configuration and the generated SQL (in `target/run/`) to confirm fully qualified names are being used where necessary. For dynamic tables, ensure the `snowflake_initialization_warehouse` parameter is correctly configured if applicable, and that the database and schema are explicit.
Upgrade
Version history
1.12.0latest on PyPI · released Jul 16, 2026
Audit
Dependencies
dbt-corerequireddbt-snowflake is an adapter plugin for dbt-core and requires it for all functionality.
Agent activity
17 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources
dbt-snowflake — pip install dbt-snowflake · libregistry