Skip to main content

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

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file llama_index_packs_snowflake_query_engine-0.5.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_packs_snowflake_query_engine-0.5.0.tar.gz
Algorithm Hash digest
SHA256 ae880a902c227804514d7cac8b625f1420ce95466456f99efba1f12771d37e51
MD5 1f367941ad71d46737f5cde1a6b08643
BLAKE2b-256 c40c97915d92a2298f284d7280fca789d479e77a7be00fc24da54d0e984cc3c9

See more details on using hashes here.

File details

Details for the file llama_index_packs_snowflake_query_engine-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_packs_snowflake_query_engine-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 354e12cb6e9e8bccb98605b933e7e12bde91226720b41ade1b3bffe2cf5d1fe3
MD5 d08dbc3c8e18208a088032174244d710
BLAKE2b-256 bc400d1f308be440b986e49883ef899919363d871542c900a61e30e553a3e036

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page