# Dagster + Snowflake

> Read and write natively to Snowflake from software-defined assets.

Source: https://dagster.io/integrations/dagster-snowflake
Category: Storage

## About this integration

This library provides an integration with the Snowflake AI Data Cloud. 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

```bash
pip install dagster-snowflake
```

## Example

```python
# Read the docs on Resources to learn more: https://docs.dagster.io/api/dagster/resources
# This integration also offers an IO manager. Learn more: https://docs.dagster.io/guides/build/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.
