Skip to content

DynamoDBClient#

Index > DynamoDB > DynamoDBClient

Auto-generated documentation for DynamoDB type annotations stubs module mypy-boto3-dynamodb.

DynamoDBClient#

Type annotations and code completion for boto3.client("dynamodb"). boto3 documentation

# DynamoDBClient usage example

from boto3.session import Session
from mypy_boto3_dynamodb.client import DynamoDBClient

def get_dynamodb_client() -> DynamoDBClient:
    return Session().client("dynamodb")

Exceptions#

boto3 client exceptions are generated in runtime. This class provides code completion for boto3.client("dynamodb").exceptions structure.

# Exceptions.exceptions usage example

client = boto3.client("dynamodb")

try:
    do_something(client)
except (
    client.exceptions.BackupInUseException,
    client.exceptions.BackupNotFoundException,
    client.exceptions.ClientError,
    client.exceptions.ConditionalCheckFailedException,
    client.exceptions.ContinuousBackupsUnavailableException,
    client.exceptions.DuplicateItemException,
    client.exceptions.ExportConflictException,
    client.exceptions.ExportNotFoundException,
    client.exceptions.GlobalTableAlreadyExistsException,
    client.exceptions.GlobalTableNotFoundException,
    client.exceptions.IdempotentParameterMismatchException,
    client.exceptions.ImportConflictException,
    client.exceptions.ImportNotFoundException,
    client.exceptions.IndexNotFoundException,
    client.exceptions.InternalServerError,
    client.exceptions.InvalidExportTimeException,
    client.exceptions.InvalidRestoreTimeException,
    client.exceptions.ItemCollectionSizeLimitExceededException,
    client.exceptions.LimitExceededException,
    client.exceptions.PointInTimeRecoveryUnavailableException,
    client.exceptions.PolicyNotFoundException,
    client.exceptions.ProvisionedThroughputExceededException,
    client.exceptions.ReplicaAlreadyExistsException,
    client.exceptions.ReplicaNotFoundException,
    client.exceptions.RequestLimitExceeded,
    client.exceptions.ResourceInUseException,
    client.exceptions.ResourceNotFoundException,
    client.exceptions.TableAlreadyExistsException,
    client.exceptions.TableInUseException,
    client.exceptions.TableNotFoundException,
    client.exceptions.TransactionCanceledException,
    client.exceptions.TransactionConflictException,
    client.exceptions.TransactionInProgressException,
) as e:
    print(e)
# Exceptions.exceptions type checking example

from mypy_boto3_dynamodb.client import Exceptions

def handle_error(exc: Exceptions.BackupInUseException) -> None:
    ...

Methods#

batch_execute_statement#

This operation allows you to perform batch reads or writes on data stored in DynamoDB, using PartiQL.

Type annotations and code completion for boto3.client("dynamodb").batch_execute_statement method. boto3 documentation

# batch_execute_statement method definition

def batch_execute_statement(
    self,
    *,
    Statements: Sequence[BatchStatementRequestTypeDef],  # (1)
    ReturnConsumedCapacity: ReturnConsumedCapacityType = ...,  # (2)
) -> BatchExecuteStatementOutputTypeDef:  # (3)
    ...
  1. See BatchStatementRequestTypeDef
  2. See ReturnConsumedCapacityType
  3. See BatchExecuteStatementOutputTypeDef
# batch_execute_statement method usage example with argument unpacking

kwargs: BatchExecuteStatementInputRequestTypeDef = {  # (1)
    "Statements": ...,
}

parent.batch_execute_statement(**kwargs)
  1. See BatchExecuteStatementInputRequestTypeDef

batch_get_item#

The BatchGetItem operation returns the attributes of one or more items from one or more tables.

Type annotations and code completion for boto3.client("dynamodb").batch_get_item method. boto3 documentation

# batch_get_item method definition

def batch_get_item(
    self,
    *,
    RequestItems: Mapping[str, Union[KeysAndAttributesTypeDef, KeysAndAttributesOutputTypeDef]],  # (1)
    ReturnConsumedCapacity: ReturnConsumedCapacityType = ...,  # (2)
) -> BatchGetItemOutputTypeDef:  # (3)
    ...
  1. See KeysAndAttributesTypeDef KeysAndAttributesOutputTypeDef
  2. See ReturnConsumedCapacityType
  3. See BatchGetItemOutputTypeDef
# batch_get_item method usage example with argument unpacking

kwargs: BatchGetItemInputRequestTypeDef = {  # (1)
    "RequestItems": ...,
}

parent.batch_get_item(**kwargs)
  1. See BatchGetItemInputRequestTypeDef

batch_write_item#

The BatchWriteItem operation puts or deletes multiple items in one or more tables.

Type annotations and code completion for boto3.client("dynamodb").batch_write_item method. boto3 documentation

# batch_write_item method definition

def batch_write_item(
    self,
    *,
    RequestItems: Mapping[str, Sequence[Union[WriteRequestTypeDef, WriteRequestOutputTypeDef]]],  # (1)
    ReturnConsumedCapacity: ReturnConsumedCapacityType = ...,  # (2)
    ReturnItemCollectionMetrics: ReturnItemCollectionMetricsType = ...,  # (3)
) -> BatchWriteItemOutputTypeDef:  # (4)
    ...
  1. See WriteRequestTypeDef WriteRequestOutputTypeDef
  2. See ReturnConsumedCapacityType
  3. See ReturnItemCollectionMetricsType
  4. See BatchWriteItemOutputTypeDef
# batch_write_item method usage example with argument unpacking

kwargs: BatchWriteItemInputRequestTypeDef = {  # (1)
    "RequestItems": ...,
}

parent.batch_write_item(**kwargs)
  1. See BatchWriteItemInputRequestTypeDef

can_paginate#

Check if an operation can be paginated.

Type annotations and code completion for boto3.client("dynamodb").can_paginate method. boto3 documentation

# can_paginate method definition

def can_paginate(
    self,
    operation_name: str,
) -> bool:
    ...

close#

Closes underlying endpoint connections.

Type annotations and code completion for boto3.client("dynamodb").close method. boto3 documentation

# close method definition

def close(
    self,
) -> None:
    ...

create_backup#

Creates a backup for an existing table.

Type annotations and code completion for boto3.client("dynamodb").create_backup method. boto3 documentation

# create_backup method definition

def create_backup(
    self,
    *,
    TableName: str,
    BackupName: str,
) -> CreateBackupOutputTypeDef:  # (1)
    ...
  1. See CreateBackupOutputTypeDef
# create_backup method usage example with argument unpacking

kwargs: CreateBackupInputRequestTypeDef = {  # (1)
    "TableName": ...,
    "BackupName": ...,
}

parent.create_backup(**kwargs)
  1. See CreateBackupInputRequestTypeDef

create_global_table#

Creates a global table from an existing table.

Type annotations and code completion for boto3.client("dynamodb").create_global_table method. boto3 documentation

# create_global_table method definition

def create_global_table(
    self,
    *,
    GlobalTableName: str,
    ReplicationGroup: Sequence[ReplicaTypeDef],  # (1)
) -> CreateGlobalTableOutputTypeDef:  # (2)
    ...
  1. See ReplicaTypeDef
  2. See CreateGlobalTableOutputTypeDef
# create_global_table method usage example with argument unpacking

kwargs: CreateGlobalTableInputRequestTypeDef = {  # (1)
    "GlobalTableName": ...,
    "ReplicationGroup": ...,
}

parent.create_global_table(**kwargs)
  1. See CreateGlobalTableInputRequestTypeDef

create_table#

The CreateTable operation adds a new table to your account.

Type annotations and code completion for boto3.client("dynamodb").create_table method. boto3 documentation

# create_table method definition

def create_table(
    self,
    *,
    AttributeDefinitions: Sequence[AttributeDefinitionTypeDef],  # (1)
    TableName: str,
    KeySchema: Sequence[KeySchemaElementTypeDef],  # (2)
    LocalSecondaryIndexes: Sequence[LocalSecondaryIndexTypeDef] = ...,  # (3)
    GlobalSecondaryIndexes: Sequence[Union[GlobalSecondaryIndexTypeDef, GlobalSecondaryIndexOutputTypeDef]] = ...,  # (4)
    BillingMode: BillingModeType = ...,  # (5)
    ProvisionedThroughput: ProvisionedThroughputTypeDef = ...,  # (6)
    StreamSpecification: StreamSpecificationTypeDef = ...,  # (7)
    SSESpecification: SSESpecificationTypeDef = ...,  # (8)
    Tags: Sequence[TagTypeDef] = ...,  # (9)
    TableClass: TableClassType = ...,  # (10)
    DeletionProtectionEnabled: bool = ...,
    ResourcePolicy: str = ...,
    OnDemandThroughput: OnDemandThroughputTypeDef = ...,  # (11)
) -> CreateTableOutputTypeDef:  # (12)
    ...
  1. See AttributeDefinitionTypeDef
  2. See KeySchemaElementTypeDef
  3. See LocalSecondaryIndexTypeDef
  4. See GlobalSecondaryIndexTypeDef GlobalSecondaryIndexOutputTypeDef
  5. See BillingModeType
  6. See ProvisionedThroughputTypeDef
  7. See StreamSpecificationTypeDef
  8. See SSESpecificationTypeDef
  9. See TagTypeDef
  10. See TableClassType
  11. See OnDemandThroughputTypeDef
  12. See CreateTableOutputTypeDef
# create_table method usage example with argument unpacking

kwargs: CreateTableInputRequestTypeDef = {  # (1)
    "AttributeDefinitions": ...,
    "TableName": ...,
    "KeySchema": ...,
}

parent.create_table(**kwargs)
  1. See