Introduction¶
Requirements¶
Python
CPython 3.11, 3.12, 3.13, 3.14
Installation¶
$ pip install PyAthena
Extra packages:
Package |
Install command |
Version |
|---|---|---|
SQLAlchemy |
|
>=2.0.0 |
AioSQLAlchemy |
|
>=2.0.0 |
Pandas |
|
>=3.0.0 |
Arrow |
|
>=22.0.0 |
Polars |
|
>=1.39.0 |
Features¶
PyAthena provides comprehensive support for Amazon Athena’s data types and features:
Core Features:
DB API 2.0 Compliance: Full PEP 249 compatibility for database operations
SQLAlchemy Integration: Native dialect support with table reflection and ORM capabilities
Multiple Cursor Types: Standard, Pandas, Arrow, Polars, S3FS and Spark cursor implementations
Async Support: Asynchronous query execution for non-blocking operations
Data Type Support:
STRUCT/ROW Types: Complete support for complex nested data structures
ARRAY Types: Complete support for ordered collections with automatic Python list conversion
MAP Types: Complete support for key-value dictionary-like data structures
JSON Integration: Seamless JSON data parsing and conversion
Performance Optimized: Smart format detection for efficient data processing
Additional Features:
Connection Management: Flexible connection configuration (credentials, role assumption, workgroups)
Result Caching: Athena query result reuse capabilities
Error Handling: Comprehensive exception handling and recovery
S3 Integration: Direct S3 data access and staging support
License¶
PyAthena’s early development was informed by PyHive, including its DB-API tests and implementation patterns. PyAthena has since evolved with substantial Athena-specific functionality and additional backends. See NOTICE for acknowledgements.