Back to integrations
Dagster + Snowflake

Dagster Integration:
Dagster + Snowflake

An integration with the Snowflake data warehouse. Read and write natively to Snowflake from Software Defined Assets.

About this integration

This library provides an integration with the Snowflake data warehouse. Connect to Snowflake as a resource, then use the integration-provided functions to construct an op to establish connections and execute Snowflake queries. Read and write natively to Snowflake from Dagster's software-defined assets (SDAs).

Installation

pip install dagster-snowflake

Example

# Read the docs on Resources to learn more: https://docs.dagster.io/deployment/resources
# This integration also offers an IO manager. Learn more: https://docs.dagster.io/concepts/io-management/io-managers
from dagster import Definitions, EnvVar, asset
from dagster_snowflake import SnowflakeResource
import os

@asset
def my_table(snowflake: SnowflakeResource):
  with snowflake.get_connection() as conn:
    return conn.cursor().execute_query("SELECT * FROM foo")

defs = Definitions(
    assets=[my_table],
    resources={
      "snowflake": SnowflakeResource(
            account="snowflake account",
            user="snowflake user",
            password=EnvVar("SNOWFLAKE_PASSWORD"),
            database="snowflake database",
            schema="snowflake schema",
            warehouse="snowflake warehouse",
        )
    }
)

About Snowflake

A cloud-based data storage and analytics service, generally termed "data-as-a-service". Snowflake's data warehouse is one of the most widely adopted cloud warehouses for analytics.