https://github.com/pyathena-dev/pyathena
PyAthena is a Python DB API 2.0 (PEP 249) client for Amazon Athena.
https://github.com/pyathena-dev/pyathena
athena aws dbapi python sqlalchemy
Last synced: about 1 month ago
JSON representation
PyAthena is a Python DB API 2.0 (PEP 249) client for Amazon Athena.
- Host: GitHub
- URL: https://github.com/pyathena-dev/pyathena
- Owner: pyathena-dev
- License: mit
- Created: 2017-05-20T23:05:31.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2026-02-15T08:20:58.000Z (about 1 month ago)
- Last Synced: 2026-02-15T13:35:45.255Z (about 1 month ago)
- Topics: athena, aws, dbapi, python, sqlalchemy
- Language: Python
- Homepage: https://pyathena-dev.github.io/PyAthena/
- Size: 18.5 MB
- Stars: 491
- Watchers: 5
- Forks: 107
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PyAthena

[](https://badge.fury.io/py/pyathena)
[](https://pypi.org/project/PyAthena/)
[](https://pepy.tech/project/pyathena)
[](https://github.com/pyathena-dev/PyAthena/actions/workflows/test.yaml)
[](https://github.com/pyathena-dev/PyAthena/actions/workflows/docs.yaml)
[](https://github.com/pyathena-dev/PyAthena/blob/master/LICENSE)
[](https://github.com/astral-sh/ruff)
[](https://mypy-lang.org/)
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.10, 3.11, 3.12, 3.13, 3.14
## Installation
```bash
$ pip install PyAthena
```
Extra packages:
| Package | Install command | Version |
|------------|--------------------------------------|----------|
| SQLAlchemy | `pip install PyAthena[SQLAlchemy]` | >=1.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
```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 aconnect
async def main():
async with await aconnect(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](LICENSE)
Many of the implementations in this library are based on [PyHive](https://github.com/dropbox/PyHive), thanks for [PyHive](https://github.com/dropbox/PyHive).
## 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).