Skip to main content

Python DB API 2.0 (PEP 249) client for Amazon Athena

Project description

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).

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyathena-3.31.1.tar.gz (135.8 kB view details)

Uploaded Source

Built Distribution

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

pyathena-3.31.1-py3-none-any.whl (191.6 kB view details)

Uploaded Python 3

File details

Details for the file pyathena-3.31.1.tar.gz.

File metadata

  • Download URL: pyathena-3.31.1.tar.gz
  • Upload date:
  • Size: 135.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyathena-3.31.1.tar.gz
Algorithm Hash digest
SHA256 14d448a1cd028ce7b33803b5c27adb20bd2b881044889704b70a061611e3ee9c
MD5 e1ce60650a9ef02d1c98d809f8e30771
BLAKE2b-256 7cccec4632ce482f95682fb61e5099b01788a6bcbdbef4f3fe0288bf89b26da8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyathena-3.31.1.tar.gz:

Publisher: release.yaml on pyathena-dev/PyAthena

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyathena-3.31.1-py3-none-any.whl.

File metadata

  • Download URL: pyathena-3.31.1-py3-none-any.whl
  • Upload date:
  • Size: 191.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyathena-3.31.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8eebd3be47eb584c4f959422c8e61d31e07195beb19f6dfedf95f65ebea84fb4
MD5 b959f978dac2eb08fe8536985e582dc2
BLAKE2b-256 db3947d9ea6ab8f2897d915b07155e22442623e62e4bd0886d9a26b34bb7250a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyathena-3.31.1-py3-none-any.whl:

Publisher: release.yaml on pyathena-dev/PyAthena

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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