> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.emtelligent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.emtelligent.com/_mcp/server.

# db.utils

Some helper utilities for working with databases.

## Module Contents

### Functions

| Name                                                       | Description                                                                                       |
| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| [`snowflake_connect`](#emtelliprodbutilssnowflake_connect) | Connect to Snowflake and return an SQLAlchemy engine. This handles private key parsing and usage. |

### API

#### `emtellipro.db.utils.snowflake_connect`

```python
emtellipro.db.utils.snowflake_connect(
    url,
    private_key_path = None,
    private_key_passphrase = None,
    **create_kwargs
) -> sqlalchemy.Engine
```

Connect to Snowflake and return an SQLAlchemy engine. This handles private
key parsing and usage.

For the specifics on which parameters are supported see the [Snowflake documentation](https://docs.snowflake.com/en/developer-guide/python-connector/sqlalchemy).

**Parameters:**

**`url`**

The connection URL; this is sent directly to `create_engine`.
The format is described in the [Snowflake documentation](https://docs.snowflake.com/en/developer-guide/python-connector/sqlalchemy).

---

**`private_key_path`**

The path to the private key, if used.

---

**`private_key_passphrase`**

If using a private key, this is the passphrase to decrypt it. This
parameter is optional, and if it's not set, the passphrase will be
read from either the `SNOWFLAKE_PRIVATE_KEY_PASSPHRASE` or
`SNOWSQL_PRIVATE_KEY_PASSPHRASE` environment variables.

---

**`**create_kwargs`**

These are passed to `create_engine` if private key path is
**not** set.

---

**Returns:**

The SQLAlchemy engine that can be used to connect to Snowflake.

**Return type:** `Engine`