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.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1f922f8bddeb9e334a2063671ba78356e0919d1ab7878a5b2fc17c2a8a61686 |
|
MD5 | e35122d4ce85458a5dc112960dafc2aa |
|
BLAKE2b-256 | 74c5489bde06d29dcc03c00edba8b83133918b55ba09e24da44a58f3143b9c0f |
Hashes for llama_index_packs_snowflake_query_engine-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76fd8e8011784ce147bda8307be140320353b34541129bdf2f8b1bf8d1ab80af |
|
MD5 | 95c6c8bf545340b82566835559825ffa |
|
BLAKE2b-256 | b1f2519b6a431efc07ac62744e60cc1238b31cfde2517fe436881067c9c52b69 |