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 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
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 usage example
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 BatchGetNamedQueryInputRequestTypeDef


session = Session()

client: AthenaClient
async with session.client("athena") as client:  # (1)
    kwargs: BatchGetNamedQueryInputRequestTypeDef = {...}  # (2)
    result: BatchGetNamedQueryOutputTypeDef = await client.batch_get_named_query(**kwargs)  # (3)
  1. client: AthenaClient
  2. kwargs: BatchGetNamedQueryInputRequestTypeDef
  3. result: BatchGetNamedQueryOutputTypeDef
Paginator usage example
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