Skip to content

Repository files navigation

PyAthena

PyAthena logo

PyPI - VersionPyPI - Python VersionPyPI - DownloadsCI - TestCD - DocsLicense - MITlinting - Rufftypes - 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:

PackageInstall commandVersion
SQLAlchemypip install PyAthena[SQLAlchemy]>=1.0.0
AioSQLAlchemypip install PyAthena[AioSQLAlchemy]>=2.0.0
Pandaspip install PyAthena[Pandas]>=1.3.0
Arrowpip install PyAthena[Arrow]>=10.0.0
Polarspip install PyAthena[Polars]>=1.0.0

Usage

frompyathenaimportconnectcursor=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:

importasynciofrompyathenaimportaio_connectasyncdefmain():
asyncwithawaitaio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
region_name="us-west-2") asconn:
cursor=conn.cursor()
awaitcursor.execute("SELECT 1")
print(awaitcursor.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).

About

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

Topics

Resources

Security policy

Stars

492 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages