PyAthena API reference
119 public APIs from PyAthena (pyathena-dev/PyAthena) — 56 classes, 10 functions, 53 methods. Signatures extracted by static analysis of the actual source.
Repository: pyathena-dev/PyAthena
| Kind | Count |
|---|---|
| Classes | 56 |
| Functions | 10 |
| Methods | 53 |
API list
class
pyathena.aio.connection.AioConnectionAsync-aware connection to Amazon Athena.
method
pyathena.aio.connection.AioConnection.create(**kwargs:Any) -> AioConnectionAsync factory for creating an ``AioConnection``.
class
pyathena.aio.cursor.AioCursorNative asyncio cursor for Amazon Athena.
method
pyathena.aio.cursor.AioCursor.fetchmany(size:int | None=None) -> list[Any | dict[Any, Any | None]]Fetch multiple rows from a query result set.
method
pyathena.aio.cursor.AioCursor.fetchone() -> Any | dict[Any, Any | None] | NoneFetch the next row of a query result set.
class
pyathena.aio.cursor.AioDictCursorNative asyncio cursor that returns rows as dictionaries.
class
pyathena.aio.result_set.AthenaAioDictResultSetAsync result set that returns rows as dictionaries.
class
pyathena.aio.result_set.AthenaAioResultSetAsync result set that provides async fetch methods.
method
pyathena.aio.result_set.AthenaAioResultSet.fetchmany(size:int | None=None) -> list[tuple[Any | None, ...] | dict[Any, Any | None]]Fetch multiple rows from the result set.
method
pyathena.aio.result_set.AthenaAioResultSet.fetchone() -> tuple[Any | None, ...] | dict[Any, Any | None] | NoneFetch the next row of the result set.
method
pyathena.aio.spark.cursor.AioSparkCursor.cancel() -> NoneCancel the currently running calculation.
method
pyathena.aio.spark.cursor.AioSparkCursor.close() -> NoneClose the cursor by terminating the Spark session.
class
pyathena.aio.sqlalchemy.base.AsyncAdapt_pyathena_connectionWraps ``AioConnection`` with a sync DBAPI interface.
class
pyathena.aio.sqlalchemy.base.AsyncAdapt_pyathena_dbapiFake DBAPI module for the async SQLAlchemy engine.
class
pyathena.aio.sqlalchemy.base.AthenaAioDialectBase async SQLAlchemy dialect for Amazon Athena.
func
pyathena.aio_connect(*args, **kwargs) -> AioConnectionCreate a new async database connection to Amazon Athena.
class
pyathena.arrow.converter.DefaultArrowUnloadTypeConverterType converter for Arrow UNLOAD operations.
func
pyathena.arrow.util.get_athena_type(type_:DataType) -> tuple[str, int, int]Map a PyArrow data type to an Athena SQL type.
func
pyathena.arrow.util.to_column_info(schema:Schema) -> tuple[dict[str, Any], ...]Convert a PyArrow schema to Athena column information.
method
pyathena.async_cursor.AsyncCursor.cancel(query_id:str) -> Future[None]Cancel a running query asynchronously.
method
pyathena.async_cursor.AsyncCursor.poll(query_id:str) -> Future[AthenaQueryExecution]Poll for query completion asynchronously.
method
pyathena.async_cursor.AsyncCursor.query_execution(query_id:str) -> Future[AthenaQueryExecution]Get query execution details asynchronously.
class
pyathena.common.BaseCursorAbstract base class for all PyAthena cursor implementations.
method
pyathena.common.BaseCursor.get_default_converter(unload:bool=False) -> DefaultTypeConverter | AnyGet the default type converter for this cursor class.
method
pyathena.common.BaseCursor.setinputsizes(sizes)Does nothing by default
method
pyathena.common.BaseCursor.setoutputsize(size, column=None)Does nothing by default
class
pyathena.connection.ConnectionA DB API 2.0 compliant connection to Amazon Athena.
method
pyathena.connection.Connection.client() -> BaseClientGet the boto3 Athena client used for query operations.
method
pyathena.connection.Connection.close() -> NoneClose the connection.
method
pyathena.connection.Connection.commit() -> NoneCommit any pending transaction.
method
pyathena.connection.Connection.retry_config() -> RetryConfigGet the retry configuration for AWS API calls.
method
pyathena.connection.Connection.rollback() -> NoneRollback any pending transaction.
method
pyathena.connection.Connection.session() -> SessionGet the boto3 session used for AWS API calls.
method
pyathena.converter.Converter.get(type_:str) -> Callable[[str | None], Any | None]Get the conversion function for a specific Athena data type.
method
pyathena.converter.Converter.get_dtype(type_:str, precision:int=0, scale:int=0) -> type[Any] | NoneGet the data type for a given Athena type.
method
pyathena.converter.Converter.mappings() -> dict[str, Callable[[str | None], Any | None]]Get the current type conversion mappings.
method
pyathena.converter.Converter.remove(type_:str) -> NoneRemove a custom conversion function for an Athena data type.
method
pyathena.converter.Converter.set(type_:str, converter:Callable[[str | None], Any | None]) -> NoneSet a custom conversion function for an Athena data type.
method
pyathena.converter.Converter.update(mappings:dict[str, Callable[[str | None], Any | None]]) -> NoneUpdate multiple conversion functions at once.
class
pyathena.error.DataErrorException for errors due to invalid data.
class
pyathena.error.DatabaseErrorBase exception for database-related errors.
class
pyathena.error.ErrorBase exception class for all PyAthena errors.
class
pyathena.error.IntegrityErrorException for data integrity constraint violations.
class
pyathena.error.InterfaceErrorException for errors related to the database interface.
class
pyathena.error.InternalErrorException for internal database errors.
class
pyathena.error.NotSupportedErrorException for unsupported database operations.
class
pyathena.error.OperationalErrorException for errors during database operation processing.
class
pyathena.error.ProgrammingErrorException for programming errors in database operations.
class
pyathena.error.WarningException for non-fatal warnings.
method
pyathena.filesystem.s3.S3File.getxattr(xattr_name:str, **kwargs) -> str | NoneGet an attribute from the user-defined metadata of the file.
method
pyathena.filesystem.s3.S3File.metadata(**kwargs) -> S3MetadataReturn the metadata of the file.
method
pyathena.filesystem.s3.S3File.setxattr(copy_kwargs:dict[str, Any] | None=None, **kwargs) -> NoneSet the user-defined metadata of the file.
method
pyathena.filesystem.s3.S3FileSystem.checksum(path:str, **kwargs)Get checksum for S3 object or directory.
method
pyathena.filesystem.s3.S3FileSystem.chmod(path:str, acl:str, recursive:bool=False, **kwargs) -> NoneSet the Access Control on a bucket/key.
method
pyathena.filesystem.s3.S3FileSystem.clear_multipart_uploads(path:str) -> NoneAbort any incomplete multipart uploads in the bucket.
method
pyathena.filesystem.s3.S3FileSystem.exists(path:str, **kwargs) -> boolCheck if an S3 path exists.
method
pyathena.filesystem.s3.S3FileSystem.find(path:str, maxdepth:int | None=None, withdirs:bool | None=None, detail:bool=False, **kwargs) -> dict[str, S3Object] | list[str]Find all files below a given S3 path.
method
pyathena.filesystem.s3.S3FileSystem.get_tags(path:str) -> dict[str, str]Retrieve the tag key/values for the given path.
method
pyathena.filesystem.s3.S3FileSystem.getxattr(path:str, attr_name:str, **kwargs) -> str | NoneGet an attribute from the user-defined metadata of the path.
method
pyathena.filesystem.s3.S3FileSystem.ls(path:str, detail:bool=False, refresh:bool=False, **kwargs) -> list[S3Object] | list[str]List contents of an S3 path.
method
pyathena.filesystem.s3.S3FileSystem.metadata(path:str, **kwargs) -> S3MetadataReturn the metadata of the path.
method
pyathena.filesystem.s3.S3FileSystem.mkdir(path:str, create_parents:bool=True, **kwargs) -> NoneCreate an S3 bucket.
method
pyathena.filesystem.s3.S3FileSystem.object_version_info(path:str, delete_markers:bool=False, **kwargs) -> list[S3ObjectVersion]List the versions of the objects under the path.
method
pyathena.filesystem.s3.S3FileSystem.pipe_file(path:str, value:bytes | bytearray | memoryview, mode:str='overwrite', **kwargs) -> NoneWrite bytes into the path.
method
pyathena.filesystem.s3.S3FileSystem.put_file(lpath:str, rpath:str, callback=_DEFAULT_CALLBACK, **kwargs)Upload a local file to S3.
method
pyathena.filesystem.s3.S3FileSystem.put_tags(path:str, tags:dict[str, str], mode:str='o') -> NoneSet the tags for the given existing key.
method
pyathena.filesystem.s3.S3FileSystem.rmdir(path:str) -> NoneRemove an S3 bucket, which must be empty.
method
pyathena.filesystem.s3.S3FileSystem.setxattr(path:str, copy_kwargs:dict[str, Any] | None=None, **kw_args) -> NoneSet the user-defined metadata of the path.
class
pyathena.filesystem.s3_async.AioS3FileAsync-aware S3 file handle using ``S3AioExecutor``.
class
pyathena.filesystem.s3_executor.S3AioExecutorExecutor that schedules work on an asyncio event loop.
class
pyathena.filesystem.s3_executor.S3ExecutorAbstract executor for parallel S3 operations.
method
pyathena.filesystem.s3_executor.S3Executor.shutdown(wait:bool=True) -> NoneShut down the executor, freeing any resources.
method
pyathena.filesystem.s3_executor.S3Executor.submit(fn:Callable[..., T], *args:Any, **kwargs:Any) -> Future[T]Submit a callable for execution and return a Future.
class
pyathena.filesystem.s3_executor.S3ThreadPoolExecutorExecutor that delegates to a ``ThreadPoolExecutor``.
class
pyathena.filesystem.s3_object.S3MultipartUploadRepresents an S3 multipart upload operation.
method
pyathena.filesystem.s3_object.S3Object.to_dict() -> dict[str, Any]Convert S3Object to dictionary representation.
class
pyathena.filesystem.s3_object.S3ObjectTypeConstants for S3 object types in filesystem operations.
class
pyathena.filesystem.s3_object.S3PutObjectRepresents the response from an S3 PUT object operation.
class
pyathena.filesystem.s3_object.S3StorageClassConstants for Amazon S3 storage classes.
class
pyathena.model.AthenaCalculationExecutionStatusStatus information for an Athena calculation execution.
class
pyathena.model.AthenaDatabaseRepresents an Athena database (schema) and its metadata.
class
pyathena.model.AthenaFileFormatConstants and utilities for Athena supported file formats.
class
pyathena.model.AthenaSessionStatusStatus information for an Athena interactive session.
class
pyathena.model.AthenaTableMetadataRepresents comprehensive metadata for an Athena table.
class
pyathena.model.AthenaTableMetadataColumnRepresents a column definition in an Athena table.
class
pyathena.pandas.converter.DefaultPandasUnloadTypeConverterType converter for pandas UNLOAD operations.
func
pyathena.pandas.util.as_pandas(cursor:Cursor, coerce_float:bool=False) -> DataFrameConvert cursor results to a pandas DataFrame.
func
pyathena.pandas.util.get_chunks(df:DataFrame, chunksize:int | None=None) -> Iterator[DataFrame]Split a DataFrame into chunks of specified size.
func
pyathena.pandas.util.reset_index(df:DataFrame, index_label:str | None=None) -> NoneReset the DataFrame index and add it as a column.
func
pyathena.pandas.util.to_sql_type_mappings(col:Series) -> strMap a pandas Series data type to an Athena SQL type.
class
pyathena.parser.TypeNodeParsed representation of an Athena DDL type signature.
method
pyathena.parser.TypeNode.get_field_type(name:str) -> TypeNode | NoneLook up a child type node by field name using a cached dict.
class
pyathena.parser.TypeSignatureParserParse Athena DDL type signature strings into a type tree.
method
pyathena.parser.TypeSignatureParser.parse(type_str:str) -> TypeNodeParse an Athena DDL type signature string into a TypeNode tree.
class
pyathena.parser.TypedValueConverterConvert values using TypeNode type information.
method
pyathena.parser.TypedValueConverter.convert(value:str, type_node:TypeNode) -> AnyConvert a value using type information from a TypeNode.
method
pyathena.polars.converter.DefaultPolarsTypeConverter.get_dtype(type_:str, precision:int=0, scale:int=0) -> AnyGet the Polars data type for a given Athena type.
class
pyathena.polars.converter.DefaultPolarsUnloadTypeConverterType converter for Polars UNLOAD operations.
func
pyathena.polars.util.get_athena_type(dtype:Any) -> tuple[str, int, int]Map a Polars data type to an Athena SQL type.
func
pyathena.polars.util.to_column_info(schema:pl.Schema) -> tuple[dict[str, Any], ...]Convert a Polars schema to Athena column information.
class
pyathena.s3fs.converter.DefaultS3FSTypeConverterType converter for S3FS Cursor results.
method
pyathena.s3fs.reader.AthenaCSVReader.close() -> NoneClose the underlying file object.
class
pyathena.s3fs.reader.DefaultCSVReaderCSV reader using Python's standard csv module.
method
pyathena.s3fs.reader.DefaultCSVReader.close() -> NoneClose the underlying file object.
class
pyathena.sqlalchemy.base.AthenaDialectSQLAlchemy dialect for Amazon Athena.
class
pyathena.sqlalchemy.compiler.AthenaStatementCompilerSQL statement compiler for Amazon Athena queries.
class
pyathena.sqlalchemy.compiler.AthenaTypeCompilerType compiler for Amazon Athena SQL types.
class
pyathena.sqlalchemy.s3fs.AthenaS3FSDialectSQLAlchemy dialect for PyAthena with S3FS cursor.
class
pyathena.sqlalchemy.types.ARRAYUppercase alias for AthenaArray type.
class
pyathena.sqlalchemy.types.AthenaArraySQLAlchemy type for Athena ARRAY complex type.
class
pyathena.sqlalchemy.types.AthenaDateSQLAlchemy type for Athena DATE values.
class
pyathena.sqlalchemy.types.AthenaMapSQLAlchemy type for Athena MAP complex type.
class
pyathena.sqlalchemy.types.AthenaStructSQLAlchemy type for Athena STRUCT/ROW complex type.
class
pyathena.sqlalchemy.types.AthenaTimestampSQLAlchemy type for Athena TIMESTAMP values.
class
pyathena.sqlalchemy.types.MAPUppercase alias for AthenaMap type.
class
pyathena.sqlalchemy.types.STRUCTUppercase alias for AthenaStruct type.
class
pyathena.sqlalchemy.types.TINYINTUppercase alias for Tinyint type.
class
pyathena.sqlalchemy.types.TinyintSQLAlchemy type for Athena TINYINT (8-bit signed integer).
func
pyathena.util.parse_output_location(output_location:str) -> tuple[str, str]Parse an S3 output location URL into bucket and key components.
About this data
These signatures were extracted from the public source of pyathena-dev/PyAthena
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.