Skip to content

Examples#

Index > SimpleDB > Examples

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

Client#

Implicit type annotations#

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

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

# SimpleDBClient 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
# ListDomainsPaginator 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 types-boto3-lite[sdb] or a standalone types_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.

# SimpleDBClient usage example with type annotations

from boto3.session import Session

from types_boto3_sdb.client import SimpleDBClient
from types_boto3_sdb.type_defs import EmptyResponseMetadataTypeDef
from types_boto3_sdb.type_defs import BatchDeleteAttributesRequestRequestTypeDef


session = Session()

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

kwargs: BatchDeleteAttributesRequestRequestTypeDef = {...}
result: EmptyResponseMetadataTypeDef = client.batch_delete_attributes(**kwargs)
# ListDomainsPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_sdb.client import SimpleDBClient
from types_boto3_sdb.paginator import ListDomainsPaginator
from types_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)