Examples
Auto-generated documentation for Glue type annotations stubs module mypy-boto3-glue.
Client
Implicit type annotations
Can be used with boto3-stubs[glue]
package installed.
Write your Glue
code as usual,
type checking and code completion should work out of the box.
Client usage example
from boto3.session import Session
session = Session()
client = session.client("glue") # (1)
result = client.batch_create_partition() # (2)
- client: GlueClient
- result: BatchCreatePartitionResponseTypeDef
Paginator usage example
from boto3.session import Session
session = Session()
client = session.client("glue") # (1)
paginator = client.get_paginator("get_classifiers") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: GlueClient
- paginator: GetClassifiersPaginator
- item: GetClassifiersResponseTypeDef
Explicit type annotations
With boto3-stubs-lite[glue]
or a standalone mypy_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.
Client usage example
from boto3.session import Session
from mypy_boto3_glue.client import GlueClient
from mypy_boto3_glue.type_defs import BatchCreatePartitionResponseTypeDef
from mypy_boto3_glue.type_defs import BatchCreatePartitionRequestRequestTypeDef
session = Session()
client: GlueClient = session.client("glue")
kwargs: BatchCreatePartitionRequestRequestTypeDef = {...}
result: BatchCreatePartitionResponseTypeDef = client.batch_create_partition(**kwargs)
Paginator usage example
from boto3.session import Session
from mypy_boto3_glue.client import GlueClient
from mypy_boto3_glue.paginator import GetClassifiersPaginator
from mypy_boto3_glue.type_defs import GetClassifiersResponseTypeDef
session = Session()
client: GlueClient = session.client("glue")
paginator: GetClassifiersPaginator = client.get_paginator("get_classifiers")
for item in paginator.paginate(...):
item: GetClassifiersResponseTypeDef
print(item)