# Airflow

### Overview

This guide walks you through updating your Apache Airflow Snowflake connection to point to Espresso's infrastructure. The key change is replacing your Snowflake host (`<your_host>.snowflakecomputing.com`) with the corresponding Espresso host (`<your_host>.espressocomputing.com`).

### Prerequisites

* Access to your Airflow environment (UI or config files)
* Your Espresso account details (host, account name, database, warehouse, etc.)
* The package `apache-airflow-providers-snowflake` must be version >= 6.0.0 for the host parameter to work.

### Steps

#### Option A: Update via the Airflow UI

1. Navigate to **Admin → Connection**s in the Airflow web UI.
2. Find and click on your Snowflake connection (default ID: `snowflake_default`).
3. In the **Extra** field, add or update the `host` parameter to your Espresso endpoint:

{% code overflow="wrap" %}

```json
{
    "account": "<your_account>",
    "database": "<your_database>",
    "warehouse": "<your_warehouse>",
    "host": "<your_host>.espressocomputing.com"
}
```

{% endcode %}

4. Update **Login** and **Password** if your Espresso credentials differ from your previous Snowflake credentials.
5. Click **Save**.

#### Option B: Update via Environment Variable (JSON format)

If you manage connections through environment variables, update the variable as follows:

{% code overflow="wrap" %}

```json
export AIRFLOW_CONN_SNOWFLAKE_DEFAULT='{
    "conn_type": "snowflake",
    "login": "<your_user>",
    "password": "<your_password>",
    "schema": "<your_schema>",
    "extra": {
        "account": "<your_account>",
        "database": "<your_database>",
        "warehouse": "<your_warehouse>",
        "host": "<your_host>.espressocomputing.com"
    }
}'
```

{% endcode %}

#### Option C: Update via Environment Variable (URI format)

If using the URI format (common in Airflow versions prior to 2.3.0):

{% code overflow="wrap" %}

```json
export AIRFLOW_CONN_SNOWFLAKE_DEFAULT='snowflake://<user>:<password>@/<schema>?account=<account>&database=<database>&warehouse=<warehouse>&host=<your_host>.espressocomputing.com'
```

{% endcode %}

**Note:** All URI components should be URL-encoded.

### Verifying the Connection

After updating, test the connection by:

1. Clicking **Test** on the connection page in the Airflow UI (Airflow 2.5+), or
2. Running a simple DAG task that queries Espresso (e.g., a `SnowflakeOperator` with `SELECT 1`).

### Troubleshooting

* **Authentication errors** — Double-check that your Login and Password match your Espresso credentials. If using key pair or OAuth authentication, ensure the relevant Extra fields (`private_key_file`, `authenticator`, etc.) are also updated.
* **Connection timeouts** — Verify that your Airflow environment has network access to `<your_host>.espressocomputing.com`.
* **Schema/database not found** — Confirm that the `database`, `schema`, and `warehouse` values exist in your Espresso account.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.espresso.ai/snowflake-optimizer/proxy-onboarding/proxy-onboarding-hex-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
