Back to integrations
Dagster + Snowflake

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 constructs 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 asset, with_resources
from dagster_snowflake import snowflake_resource
import os

@asset(required_resource_keys={'snowflake'})
def my_table(context):
    return context.resources.snowflake.execute_query('SELECT * FROM foo')

assets = with_resources([my_table], resource_defs={
    'snowflake': snowflake_resource.configured({
        'account': 'snowflake account',
        'user': 'snowflake user',
        'password': os.environ['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.