Skip to main content

Athena reader.

pip install llama-index-readers-athena

pip install llama-index-llms-openai

Athena reader allow execute SQL with AWS Athena. We using SQLAlchemy and PyAthena under the hood.

Permissions

WE HIGHLY RECOMMEND USING THIS LOADER WITH AWS EC2 IAM ROLE.

Usage

Here's an example usage of the AthenaReader.

import os
import dotenv
from llama_index.core import SQLDatabase,ServiceContext
from llama_index.core.query_engine import NLSQLTableQueryEngine
from llama_index.llms.openai import OpenAI
from llama_index.readers.athena import AthenaReader

dotenv.load_dotenv()

AWS_REGION = os.environ['AWS_REGION']
S3_STAGING_DIR = os.environ['S3_STAGING_DIR']
DATABASE = os.environ['DATABASE']
WORKGROUP = os.environ['WORKGROUP']
TABLE = os.environ['TABLE']

llm = OpenAI(model="gpt-4",temperature=0, max_tokens=1024)

engine = AthenaReader.create_athena_engine(
    aws_region=AWS_REGION,
    s3_staging_dir=S3_STAGING_DIR,
    database=DATABASE,
    workgroup=WORKGROUP
)

service_context = ServiceContext.from_defaults(
  llm=llm
)

sql_database = SQLDatabase(engine, include_tables=[TABLE])

query_engine = NLSQLTableQueryEngine(
    sql_database=sql_database,
    tables=[TABLE],
    service_context=service_context
)
query_str = (
    "Which blocknumber has the most transactions?"
)
response = query_engine.query(query_str)

Screeshot

image

Metadata

Release files for llama-index-readers-athena 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-readers-athena 0.6.0
File Size Uploaded Provenance Actions
llama_index_readers_athena-0.6.0.tar.gz 4.4 kB Without provenance Details for llama_index_readers_athena-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-readers-athena 0.6.0
File Interpreter ABI Platform Actions
llama_index_readers_athena-0.6.0-py3-none-any.whl Python 3 none any Details for llama_index_readers_athena-0.6.0-py3-none-any.whl

Total release size: 8.3 kB

Release files / llama_index_readers_athena-0.6.0.tar.gz

Download URL llama_index_readers_athena-0.6.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b0c1ddfa3a456f84a32138aeef30696312fae8b8998083f4051383dc04dac6db
BLAKE2b-256 checksum
How to use checksums
e7bb90979193b7e0aff30b92d130de044167fe299bf7c24e67bbf3407c92450f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llama_index_readers_athena-0.6.0-py3-none-any.whl

Download URL llama_index_readers_athena-0.6.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7a89a29eae0b0107a2db9e2a53223a521e2b6a7241ba87312f139aad3b0f93a
BLAKE2b-256 checksum
How to use checksums
3128b36b4a78c51cfb009dfa1756089db06915e439db48c6dcb04d8956991a4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for llama-index-readers-athena 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page