Metadata-Version: 2.5
Name: PyAthena
Version: 4.1.0
Summary: Python DB API 2.0 (PEP 249) client for Amazon Athena
Project-URL: homepage, https://pyathena.dev/
Project-URL: repository, https://github.com/pyathena-dev/PyAthena/
Project-URL: documentation, https://pyathena.dev/
Project-URL: issues, https://github.com/pyathena-dev/PyAthena/issues
Project-URL: changelog, https://github.com/pyathena-dev/PyAthena/releases
Author: The PyAthena authors
Maintainer-email: laughingman7743 <laughingman7743@gmail.com>
License-Expression: MIT
License-File: LICENSE
License-File: NOTICE
Keywords: amazon-athena,asyncio,athena,aws,dbapi,fsspec,pandas,pep249,polars,pyarrow,s3,spark,sql,sqlalchemy
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Database
Classifier: Topic :: Database :: Front-Ends
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: boto3>=1.43.31
Requires-Dist: botocore>=1.43.31
Requires-Dist: fsspec>=2026.9.0
Requires-Dist: tenacity>=8.0.1
Requires-Dist: tzdata
Provides-Extra: aiosqlalchemy
Requires-Dist: sqlalchemy[asyncio]>=2.0.0; extra == 'aiosqlalchemy'
Provides-Extra: arrow
Requires-Dist: pyarrow>=22.0.0; extra == 'arrow'
Provides-Extra: pandas
Requires-Dist: pandas>=3.0.0; extra == 'pandas'
Provides-Extra: polars
Requires-Dist: polars>=1.39.0; extra == 'polars'
Provides-Extra: sqlalchemy
Requires-Dist: sqlalchemy>=2.0.0; extra == 'sqlalchemy'
Description-Content-Type: text/markdown

<!--
Copyright 2017 The PyAthena authors

Licensed under the MIT License.
See LICENSE or https://opensource.org/licenses/MIT.

SPDX-License-Identifier: MIT
-->

# PyAthena

<div align="center">

<img src="https://raw.githubusercontent.com/pyathena-dev/PyAthena/master/docs/_static/icon.png" alt="PyAthena logo" width="250">

[![PyPI - Version](https://badge.fury.io/py/pyathena.svg)](https://badge.fury.io/py/pyathena)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/PyAthena.svg)](https://pypi.org/project/PyAthena/)
[![PyPI - Downloads](https://static.pepy.tech/badge/pyathena/month)](https://pepy.tech/project/pyathena)
[![CI - Test](https://github.com/pyathena-dev/PyAthena/actions/workflows/test.yaml/badge.svg?branch=master)](https://github.com/pyathena-dev/PyAthena/actions/workflows/test.yaml?query=branch%3Amaster)
[![CD - Docs](https://github.com/pyathena-dev/PyAthena/actions/workflows/docs.yaml/badge.svg)](https://github.com/pyathena-dev/PyAthena/actions/workflows/docs.yaml)
[![License - MIT](https://img.shields.io/pypi/l/PyAthena.svg)](https://github.com/pyathena-dev/PyAthena/blob/master/LICENSE)
[![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![types - Mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)

</div>

PyAthena is a Python [DB API 2.0 (PEP 249)](https://www.python.org/dev/peps/pep-0249/) client for [Amazon Athena](https://docs.aws.amazon.com/athena/latest/APIReference/Welcome.html).

-----

## Requirements

- Python

  - CPython 3.11, 3.12, 3.13, 3.14

## Installation

```bash
$ pip install PyAthena
```

Extra packages:

| Package       | Install command                         | Version  |
|---------------|-----------------------------------------|----------|
| SQLAlchemy    | `pip install PyAthena[SQLAlchemy]`      | >=2.0.0  |
| AioSQLAlchemy | `pip install PyAthena[AioSQLAlchemy]`   | >=2.0.0  |
| Pandas        | `pip install PyAthena[Pandas]`          | >=3.0.0  |
| Arrow         | `pip install PyAthena[Arrow]`           | >=22.0.0 |
| Polars        | `pip install PyAthena[Polars]`          | >=1.39.0 |

## Usage

```python
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:

```python
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())
```

## Contributing

Contributions, including AI-assisted contributions, are welcome.
Please read [CONTRIBUTING.md](https://github.com/pyathena-dev/PyAthena/blob/master/CONTRIBUTING.md) before starting a change.

## License

[MIT license](https://github.com/pyathena-dev/PyAthena/blob/master/LICENSE)

PyAthena's early development was informed by [PyHive](https://github.com/dropbox/PyHive), including its DB-API tests and implementation patterns.
PyAthena has since evolved with substantial Athena-specific functionality and additional backends.
See [NOTICE](https://github.com/pyathena-dev/PyAthena/blob/master/NOTICE) for acknowledgements.

## Links

- Documentation: <https://pyathena.dev/>
- PyPI Releases: <https://pypi.org/project/PyAthena/>
- Source Code: <https://github.com/pyathena-dev/PyAthena/>
- Issue Tracker: <https://github.com/pyathena-dev/PyAthena/issues>

## Logo

The PyAthena logo was generated using [Nano-Banana Pro](https://deepmind.google/models/gemini-image/pro/) (Gemini 3 Pro Image).
