Skip to content

Examples#

Index > Glue > Examples

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

Client#

Implicit type annotations#

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

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

# GlueClient usage example

from boto3.session import Session


session = Session()

client = session.client("glue")  # (1)
result = client.batch_create_partition()  # (2)
  1. client: GlueClient
  2. result: BatchCreatePartitionResponseTypeDef
# DescribeEntityPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("glue")  # (1)

paginator = client.get_paginator("describe_entity")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: GlueClient
  2. paginator: DescribeEntityPaginator
  3. item: DescribeEntityResponseTypeDef

Explicit type annotations#

With types-boto3-lite[glue] or a standalone types_boto3_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 boto3.session import Session

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


session = Session()

client: GlueClient = session.client("glue")

kwargs: BatchCreatePartitionRequestRequestTypeDef = {...}
result: BatchCreatePartitionResponseTypeDef = client.batch_create_partition(**kwargs)
# DescribeEntityPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_glue.client import GlueClient
from types_boto3_glue.paginator import DescribeEntityPaginator
from types_boto3_glue.type_defs import DescribeEntityResponseTypeDef


session = Session()
client: GlueClient = session.client("glue")

paginator: DescribeEntityPaginator = client.get_paginator("describe_entity")
for item in paginator.paginate(...):
    item: DescribeEntityResponseTypeDef
    print(item)