> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fiddler.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Snowflake

> Learn how to extract baseline or production data from Snowflake for model onboarding and publishing production data to Fiddler for ML and LLM monitoring.

In this article, we will be looking at loading data from Snowflake tables and using the data for the following tasks:

1. Onboarding a model to Fiddler
2. Uploading baseline data to Fiddler
3. Publishing production data to Fiddler

## Import data from Snowflake

In order to import data from Snowflake to a Jupyter notebook, we will use the snowflake library which can be installed using the following command in your Python environment.

```bash theme={null}
pip install snowflake-connector-python
```

The following information is required in order to establish a connection to Snowflake:

* Snowflake Warehouse
* Snowflake Role
* Snowflake Account
* Snowflake User
* Snowflake Password

These values can be obtained from your Snowflake account under the ‘Admin’ option in the Menu as shown below or by running the queries below:

* Warehouse - select CURRENT\_WAREHOUSE()
* Role - select CURRENT\_ROLE()
* Account - select CURRENT\_ACCOUNT()

'User' and 'Password' are the same that you use when logging in to your Snowflake account.

<img src="https://mintcdn.com/fiddlerai/0YAzrIgYU8gLFpZN/images/c2f4cf4-screen-shot-2022-06-14-at-41736-pm.png?fit=max&auto=format&n=0YAzrIgYU8gLFpZN&q=85&s=d086975e26de6a5794fcb6ea76a77ca5" alt="Example Snowflake dashboard showing the Warehouse tab." width="1873" height="653" data-path="images/c2f4cf4-screen-shot-2022-06-14-at-41736-pm.png" />

Once you have this information, you can set up a Snowflake connector using the following code:

```python theme={null}
# establish Snowflake connection
connection = connector.connect(
  user=snowflake_username,
  password=snowflake_password,
  account=snowflake_account,
  role=snowflake_role,
  warehouse=snowflake_warehouse
)
```

You can then write a custom SQL query and import the data to a pandas dataframe.

```python theme={null}
# sample SQL query
sql_query = 'select * from FIDDLER.FIDDLER_SCHEMA.CHURN_BASELINE LIMIT 100'

# create cursor object
cursor = connection.cursor()

# execute SQL query inside Snowflake
cursor.execute(sql_query)

baseline_df = cursor.fetch_pandas_all()
```

## Publish Production Events

Now that we have data imported from Snowflake to a dataframe, we can refer to the following pages to:

1. [Onboard a model](/developers/python-client-guides/model-onboarding/create-a-project-and-model) using the baseline dataset for the model schema inference sample.
2. [Upload a Baseline dataset](/developers/python-client-guides/publishing-production-data/creating-a-baseline-dataset), which is optional but recommended for monitoring comparisons.
3. [Publish production events](/developers/client-library-reference/publishing-production-data) for continuous monitoring.
