Examples#
Auto-generated documentation for Athena type annotations stubs module mypy-boto3-athena.
Client#
Implicit type annotations#
Can be used with boto3-stubs[athena]
package installed.
Write your Athena
code as usual,
type checking and code completion should work out of the box.
# AthenaClient usage example
from boto3.session import Session
session = Session()
client = session.client("athena") # (1)
result = client.batch_get_named_query() # (2)
- client: AthenaClient
- result: BatchGetNamedQueryOutputTypeDef
# GetQueryResultsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("athena") # (1)
paginator = client.get_paginator("get_query_results") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: AthenaClient
- paginator: GetQueryResultsPaginator
- item: GetQueryResultsOutputTypeDef
Explicit type annotations#
With boto3-stubs-lite[athena]
or a standalone mypy_boto3_athena
package, you have to explicitly specify client: AthenaClient
type annotation.
All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.
# AthenaClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_athena.client import AthenaClient
from mypy_boto3_athena.type_defs import BatchGetNamedQueryOutputTypeDef
from mypy_boto3_athena.type_defs import BatchGetNamedQueryInputRequestTypeDef
session = Session()
client: AthenaClient = session.client("athena")
kwargs: BatchGetNamedQueryInputRequestTypeDef = {...}
result: BatchGetNamedQueryOutputTypeDef = client.batch_get_named_query(**kwargs)
# GetQueryResultsPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_athena.client import AthenaClient
from mypy_boto3_athena.paginator import GetQueryResultsPaginator
from mypy_boto3_athena.type_defs import GetQueryResultsOutputTypeDef
session = Session()
client: AthenaClient = session.client("athena")
paginator: GetQueryResultsPaginator = client.get_paginator("get_query_results")
for item in paginator.paginate(...):
item: GetQueryResultsOutputTypeDef
print(item)