Metadata-Version: 2.1
Name: llama-index-packs-snowflake-query-engine
Version: 0.3.0
Summary: llama-index packs snowflake_query_engine integration
License: MIT
Keywords: engine,query,snowflake
Author: Your Name
Author-email: you@example.com
Maintainer: wenqiglantz
Requires-Python: >=3.8.1,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: llama-index-core (>=0.11.0,<0.12.0)
Description-Content-Type: text/markdown

# Snowflake Query Engine Pack

This LlamaPack uses `snowflake-sqlalchemy` to connect to Snowflake, then calls `NLSQLTableQueryEngine` to query data.

## Usage

You can download the pack to a the `./snowflake_pack` directory:

```python
from llama_index.core.llama_pack import download_llama_pack

# download and install dependencies
SnowflakeQueryEnginePack = download_llama_pack(
    "SnowflakeQueryEnginePack", "./snowflake_pack"
)
```

From here, you can use the pack, or inspect and modify the pack in `./snowflake_pack`.

`NLSQLTableQueryEngine` uses OpenAI models by default, ensure you set your OpenAI API key.

You can set up the pack by passing in the Snowflake connection details and the table(s):

```python
# create the pack
snowflake_pack = SnowflakeQueryEnginePack(
    user="<USER>",
    password="<PASSWORD>",
    account="<ORG>-<ACCOUNT>",
    database="<DATABASE>",
    schema="<SCHEMA>",
    warehouse="<WAREHOUSE>",
    role="<ROLE>",
    tables=["<TABLE1>", "<TABLE2>", ...],
)
```

The `run()` function is a light wrapper around `query_engine.query()`. See below a sample query run. You can add additional prompt in the query text.

```python
response = snowflake_pack.run(
    "Give me the repo id with the most stars on 2023-12-01."
)
```

