llama-index packs snowflake_query_engine integration
Project description
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:
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):
# 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.
response = snowflake_pack.run(
"Give me the repo id with the most stars on 2023-12-01."
)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file llama_index_packs_snowflake_query_engine-0.2.0.tar.gz
.
File metadata
- Download URL: llama_index_packs_snowflake_query_engine-0.2.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7c2802a0f7bd71885785a31b1c03dcf0fc76abaeff70cde78fa6eb48a03d55d |
|
MD5 | 231126b588e3e6fced3e70217014ce5e |
|
BLAKE2b-256 | 497147c74ca4e9d84232572be71c3d6ba09588f05a70480bb6a92adf8306629d |
File details
Details for the file llama_index_packs_snowflake_query_engine-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_packs_snowflake_query_engine-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 048807bfca256cb9fb07d40a5569875c0418d01dbac963dbc17160fba9258218 |
|
MD5 | 91cd05421300077378b99ef9c1530b35 |
|
BLAKE2b-256 | 17b16af0670abd45379421a8b31fa0a3205d5ef2b7b3b7c0a3f7debf52a2cd4d |