Skip to content

Examples#

Index > Athena > Examples

Auto-generated documentation for Athena type annotations stubs module types-aiobotocore-athena.

Client#

Implicit type annotations#

Can be used with types-aiobotocore[athena] package installed.

Write your Athena code as usual, type checking and code completion should work out of the box.

# AthenaClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("athena") as client:  # (1)
    result = await client.batch_get_named_query()  # (2)
  1. client: AthenaClient
  2. result: BatchGetNamedQueryOutputTypeDef
# GetQueryResultsPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("athena") as client:  # (1)
    paginator = client.get_paginator("get_query_results")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: AthenaClient
  2. paginator: GetQueryResultsPaginator
  3. item: GetQueryResultsOutputTypeDef

Explicit type annotations#

With types-aiobotocore-lite[athena] or a standalone types_aiobotocore_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 aiobotocore.session import get_session

from types_aiobotocore_athena.client import AthenaClient
from types_aiobotocore_athena.type_defs import BatchGetNamedQueryOutputTypeDef
from types_aiobotocore_athena.type_defs import BatchGetNamedQueryInputRequestTypeDef


session = get_session()

async with session.create_client("athena") as client:
    client: AthenaClient
    kwargs: BatchGetNamedQueryInputRequestTypeDef = {...}
    result: BatchGetNamedQueryOutputTypeDef = await client.batch_get_named_query(**kwargs)
# GetQueryResultsPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_athena.client import AthenaClient
from types_aiobotocore_athena.paginator import GetQueryResultsPaginator
from types_aiobotocore_athena.type_defs import GetQueryResultsOutputTypeDef


session = get_session()

async with session.create_client("athena") as client:
    client: AthenaClient
    paginator: GetQueryResultsPaginator = client.get_paginator("get_query_results")
    async for item in paginator.paginate(...):
        item: GetQueryResultsOutputTypeDef
        print(item)