MCPcopy Index your code
hub / github.com/pyathena-dev/PyAthena

github.com/pyathena-dev/PyAthena @v3.34.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.34.0 ↗ · + Follow
2,315 symbols 8,228 edges 145 files 547 documented · 24% 4 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

PyAthena

PyAthena logo

PyPI - Version PyPI - Python Version PyPI - Downloads CI - Test CD - Docs License - MIT linting - Ruff types - Mypy

PyAthena is a Python DB API 2.0 (PEP 249) client for Amazon Athena.


Requirements

  • Python

  • CPython 3.10, 3.11, 3.12, 3.13, 3.14

Installation

$ pip install PyAthena

Extra packages:

Package Install command Version
SQLAlchemy pip install PyAthena[SQLAlchemy] >=1.0.0
AioSQLAlchemy pip install PyAthena[AioSQLAlchemy] >=2.0.0
Pandas pip install PyAthena[Pandas] >=1.3.0
Arrow pip install PyAthena[Arrow] >=10.0.0
Polars pip install PyAthena[Polars] >=1.0.0

Usage

from pyathena import connect

cursor = connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
                 region_name="us-west-2").cursor()
cursor.execute("SELECT * FROM one_row")
print(cursor.description)
print(cursor.fetchall())

Native asyncio is also supported:

import asyncio
from pyathena import aio_connect

async def main():
    async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
                              region_name="us-west-2") as conn:
        cursor = conn.cursor()
        await cursor.execute("SELECT 1")
        print(await cursor.fetchone())

asyncio.run(main())

License

MIT license

Many of the implementations in this library are based on PyHive, thanks for PyHive.

Links

Logo

The PyAthena logo was generated using Nano-Banana Pro (Gemini 3 Pro Image).

Core symbols most depended-on inside this repo

Shape

Method 1,950
Class 201
Function 144
Route 20

Languages

Python100%

Modules by API surface

pyathena/filesystem/s3_object.py126 symbols
pyathena/result_set.py115 symbols
pyathena/model.py113 symbols
tests/pyathena/filesystem/test_s3.py88 symbols
tests/pyathena/sqlalchemy/test_base.py82 symbols
tests/pyathena/test_cursor.py80 symbols
pyathena/sqlalchemy/compiler.py78 symbols
pyathena/filesystem/s3.py73 symbols
tests/pyathena/test_converter.py56 symbols
tests/pyathena/filesystem/test_s3_async.py50 symbols
tests/pyathena/pandas/test_cursor.py48 symbols
pyathena/common.py46 symbols

For agents

$ claude mcp add PyAthena \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page