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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffa5b87c3149123e20a67ef9b490ac1aed581c5b1cbebb624c44fbc93882ca05 |
|
MD5 | 1037997017f23e89f6d4e6b3fad06b14 |
|
BLAKE2b-256 | d06615fce3e356e188563b28ddd30966728667b4dc4821d8d0d04a012ee3a41b |
Hashes for llama_index_packs_snowflake_query_engine-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7bfd2178e6eb1f9baef7844100c78e3a284883fad8b27c070f8f8fcfefeef57 |
|
MD5 | 50064c8f2d3a7232ebb1b3d3907e4597 |
|
BLAKE2b-256 | 99a2d5791a1d6de6dc51ad3c3f04234746ebf1826b03fc472c786a58b6d436c3 |