Skip to content

Examples#

Index > S3Tables > Examples

Auto-generated documentation for S3Tables type annotations stubs module types-boto3-s3tables.

Client#

Implicit type annotations#

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

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

# S3TablesClient usage example

from boto3.session import Session


session = Session()

client = session.client("s3tables")  # (1)
result = client.create_namespace()  # (2)
  1. client: S3TablesClient
  2. result: CreateNamespaceResponseTypeDef
# ListNamespacesPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_namespaces")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: S3TablesClient
  2. paginator: ListNamespacesPaginator
  3. item: ListNamespacesResponseTypeDef

Explicit type annotations#

With types-boto3-lite[s3tables] or a standalone types_boto3_s3tables package, you have to explicitly specify client: S3TablesClient 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.

# S3TablesClient usage example with type annotations

from boto3.session import Session

from types_boto3_s3tables.client import S3TablesClient
from types_boto3_s3tables.type_defs import CreateNamespaceResponseTypeDef
from types_boto3_s3tables.type_defs import CreateNamespaceRequestRequestTypeDef


session = Session()

client: S3TablesClient = session.client("s3tables")

kwargs: CreateNamespaceRequestRequestTypeDef = {...}
result: CreateNamespaceResponseTypeDef = client.create_namespace(**kwargs)
# ListNamespacesPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_s3tables.client import S3TablesClient
from types_boto3_s3tables.paginator import ListNamespacesPaginator
from types_boto3_s3tables.type_defs import ListNamespacesResponseTypeDef


session = Session()
client: S3TablesClient = session.client("s3tables")

paginator: ListNamespacesPaginator = client.get_paginator("list_namespaces")
for item in paginator.paginate(...):
    item: ListNamespacesResponseTypeDef
    print(item)