Skip to content

Examples

Index > SimpleDB > Examples

Auto-generated documentation for SimpleDB type annotations stubs module mypy-boto3-sdb.

Client

Implicit type annotations

Can be used with boto3-stubs[sdb] package installed.

Write your SimpleDB 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("sdb")  # (1)
result = client.batch_delete_attributes()  # (2)
  1. client: SimpleDBClient
  2. result: EmptyResponseMetadataTypeDef
Paginator usage example
from boto3.session import Session


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

paginator = client.get_paginator("list_domains")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: SimpleDBClient
  2. paginator: ListDomainsPaginator
  3. item: ListDomainsResultTypeDef

Explicit type annotations

With boto3-stubs-lite[sdb] or a standalone mypy_boto3_sdb package, you have to explicitly specify client: SimpleDBClient 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_sdb.client import SimpleDBClient
from mypy_boto3_sdb.type_defs import EmptyResponseMetadataTypeDef
from mypy_boto3_sdb.type_defs import BatchDeleteAttributesRequestRequestTypeDef


session = Session()

client: SimpleDBClient = session.client("sdb")

kwargs: BatchDeleteAttributesRequestRequestTypeDef = {...}
result: EmptyResponseMetadataTypeDef = client.batch_delete_attributes(**kwargs)
Paginator usage example
from boto3.session import Session

from mypy_boto3_sdb.client import SimpleDBClient
from mypy_boto3_sdb.paginator import ListDomainsPaginator
from mypy_boto3_sdb.type_defs import ListDomainsResultTypeDef


session = Session()
client: SimpleDBClient = session.client("sdb")

paginator: ListDomainsPaginator = client.get_paginator("list_domains")
for item in paginator.paginate(...):
    item: ListDomainsResultTypeDef
    print(item)