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-aioboto3[athena] package installed.

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

Client method usage example#

# AthenaClient usage example

from aioboto3.session import Session


session = Session()

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

Paginator usage example#

# GetQueryResultsPaginator usage example

from aioboto3.session import Session


session = Session()

async with session.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-aioboto3-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.

Client method usage example#

# AthenaClient usage example with type annotations

from aioboto3.session import Session

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


session = Session()

client: AthenaClient
async with session.client("athena") as client:  # (1)
    kwargs: BatchGetNamedQueryInputTypeDef = {...}  # (2)
    result: BatchGetNamedQueryOutputTypeDef = await client.batch_get_named_query(**kwargs)  # (3)
  1. client: AthenaClient
  2. kwargs: BatchGetNamedQueryInputTypeDef
  3. result: BatchGetNamedQueryOutputTypeDef

Paginator usage example#

# GetQueryResultsPaginator usage example with type annotations

from aioboto3.session import Session

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


session = Session()

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