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
Hashes for llama_index_packs_snowflake_query_engine-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e90c57ef249188ded94588e0f2563dffef147a66830a680783cf2d2fd47134bd |
|
MD5 | b4839cc7f3688278b8356293112345f1 |
|
BLAKE2b-256 | 871e0542a9026cbf934455f8f7c7c2119de86d6a6b384a51d040a62871b738fa |
Hashes for llama_index_packs_snowflake_query_engine-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d52560bd775bfd2fb8b04260b9e7801bddf06f25568674f491ba7496a62ca8c |
|
MD5 | 54fc8df1907995235c33b6b6b4fe948e |
|
BLAKE2b-256 | c73100b8f6fe3824268f0d9dc2bb067394c43e6bf9e69cb757a97513d2f0683e |