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.4.0.tar.gz
.
File metadata
- Download URL: llama_index_packs_snowflake_query_engine-0.4.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 626e91ea4e543ff80c71d8b1beb5e26250e5e9f82429f9a7a23d32505e3a0dde |
|
MD5 | ab6976a0ef54b32bd34532a54a8b4296 |
|
BLAKE2b-256 | 8e9780710c12ae480a808c2f9e63f91a92fd4b64e236c8c59872cb3e655c266d |
File details
Details for the file llama_index_packs_snowflake_query_engine-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_packs_snowflake_query_engine-0.4.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.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 383af6dcef54bfd37907a26d5101c5b89df0fc73c3da89af12c73e88b9b599e7 |
|
MD5 | 958a63c377f3e0b9c6250fa31195905d |
|
BLAKE2b-256 | 32109dfc0a437ac6ae64836cccafc26dc1b500a5ac9b11aa8302b96bdd4e9c60 |