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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b798e6a335210c5697aa1836586ee91b1f1c86f5d0688b7bbaba265622f3ba22 |
|
MD5 | 661668ac4d493dcb087d5f846b99a5f5 |
|
BLAKE2b-256 | 4bfabdfcb17061e3f2b84b48b4be819d74b3b97d2955ff80e2d8af76392c91cc |
Hashes for llama_index_packs_snowflake_query_engine-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80137a61afb5ab60e2146e88e220a0a2a07c8a2820c9af6c5d96bbe36e4df5db |
|
MD5 | 1f886ad16dc08510492dfd4dc01ddca9 |
|
BLAKE2b-256 | 8e40ee44fca1489d00c07d5d3d24e06559099193f63e8906db83a2f407659203 |