Skip to content

Examples#

Index > Glue > Examples

Auto-generated documentation for Glue type annotations stubs module types-aiobotocore-glue.

Client#

Implicit type annotations#

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

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

# GlueClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("glue") as client:  # (1)
    result = await client.batch_create_partition()  # (2)
  1. client: GlueClient
  2. result: BatchCreatePartitionResponseTypeDef
# GetClassifiersPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("glue") as client:  # (1)
    paginator = client.get_paginator("get_classifiers")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: GlueClient
  2. paginator: GetClassifiersPaginator
  3. item: GetClassifiersResponseTypeDef

Explicit type annotations#

With types-aiobotocore-lite[glue] or a standalone types_aiobotocore_glue package, you have to explicitly specify client: GlueClient 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.

# GlueClient usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_glue.client import GlueClient
from types_aiobotocore_glue.type_defs import BatchCreatePartitionResponseTypeDef
from types_aiobotocore_glue.type_defs import BatchCreatePartitionRequestRequestTypeDef


session = get_session()

async with session.create_client("glue") as client:
    client: GlueClient
    kwargs: BatchCreatePartitionRequestRequestTypeDef = {...}
    result: BatchCreatePartitionResponseTypeDef = await client.batch_create_partition(**kwargs)
# GetClassifiersPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_glue.client import GlueClient
from types_aiobotocore_glue.paginator import GetClassifiersPaginator
from types_aiobotocore_glue.type_defs import GetClassifiersResponseTypeDef


session = get_session()

async with session.create_client("glue") as client:
    client: GlueClient
    paginator: GetClassifiersPaginator = client.get_paginator("get_classifiers")
    async for item in paginator.paginate(...):
        item: GetClassifiersResponseTypeDef
        print(item)