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.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, KeysAndAttributesTypeDef],  # (1)
    ReturnConsumedCapacity: ReturnConsumedCapacityType = ...,  # (2)
) -> BatchGetItemOutputTypeDef:  # (3)
    ...
  1. See KeysAndAttributesTypeDef
  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[WriteRequestTypeDef]],  # (1)
    ReturnConsumedCapacity: ReturnConsumedCapacityType = ...,  # (2)
    ReturnItemCollectionMetrics: ReturnItemCollectionMetricsType = ...,  # (3)
) -> BatchWriteItemOutputTypeDef:  # (4)
    ...
  1. See WriteRequestTypeDef
  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[GlobalSecondaryIndexTypeDef] = ...,  # (4)
    BillingMode: BillingModeType = ...,  # (5)
    ProvisionedThroughput: ProvisionedThroughputTypeDef = ...,  # (6)
    StreamSpecification: StreamSpecificationTypeDef = ...,  # (7)
    SSESpecification: SSESpecificationTypeDef = ...,  # (8)
    Tags: Sequence[TagTypeDef] = ...,  # (9)
    TableClass: TableClassType = ...,  # (10)
    DeletionProtectionEnabled: bool = ...,
) -> CreateTableOutputTypeDef:  # (11)
    ...
  1. See AttributeDefinitionTypeDef
  2. See KeySchemaElementTypeDef
  3. See LocalSecondaryIndexTypeDef
  4. See GlobalSecondaryIndexTypeDef
  5. See BillingModeType
  6. See ProvisionedThroughputTypeDef
  7. See StreamSpecificationTypeDef
  8. See SSESpecificationTypeDef
  9. See TagTypeDef
  10. See TableClassType
  11. See CreateTableOutputTypeDef
# create_table method usage example with argument unpacking

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

parent.create_table(**kwargs)
  1. See CreateTableInputRequestTypeDef

delete_backup#

Deletes an existing backup of a table.

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

# delete_backup method definition

def delete_backup(
    self,
    *,
    BackupArn: str,
) -> DeleteBackupOutputTypeDef:  # (1)
    ...
  1. See DeleteBackupOutputTypeDef
# delete_backup method usage example with argument unpacking

kwargs: DeleteBackupInputRequestTypeDef = {  # (1)
    "BackupArn": ...,
}

parent.delete_backup(**kwargs)
  1. See DeleteBackupInputRequestTypeDef

delete_item#

Deletes a single item in a table by primary key.

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

# delete_item method definition

def delete_item(
    self,
    *,
    TableName: str,
    Key: Mapping[str, Union[AttributeValueTypeDef, bytes, bytearray, str, int, Decimal, bool, Set[int], Set[Decimal], Set[str], Set[bytes], Set[bytearray], Sequence[Any], Mapping[str, Any], None]],  # (1)
    Expected: Mapping[str, ExpectedAttributeValueTypeDef] = ...,  # (2)
    ConditionalOperator: ConditionalOperatorType = ...,  # (3)
    ReturnValues: ReturnValueType = ...,  # (4)
    ReturnConsumedCapacity: ReturnConsumedCapacityType = ...,  # (5)
    ReturnItemCollectionMetrics: ReturnItemCollectionMetricsType = ...,  # (6)
    ConditionExpression: str = ...,
    ExpressionAttributeNames: Mapping[str, str] = ...,
    ExpressionAttributeValues: Mapping[str, Union[AttributeValueTypeDef, bytes, bytearray, str, int, Decimal, bool, Set[int], Set[Decimal], Set[str], Set[bytes], Set[bytearray], Sequence[Any], Mapping[str, Any], None]] = ...,  # (1)
    ReturnValuesOnConditionCheckFailure: ReturnValuesOnConditionCheckFailureType = ...,  # (8)
) -> DeleteItemOutputTypeDef:  # (9)
    ...
  1. See AttributeValueTypeDef
  2. See ExpectedAttributeValueTypeDef
  3. See ConditionalOperatorType
  4. See ReturnValueType
  5. See ReturnConsumedCapacityType
  6. See ReturnItemCollectionMetricsType
  7. See AttributeValueTypeDef
  8. See ReturnValuesOnConditionCheckFailureType
  9. See DeleteItemOutputTypeDef
# delete_item method usage example with argument unpacking

kwargs: DeleteItemInputRequestTypeDef = {  # (1)
    "TableName": ...,
    "Key": ...,
}

parent.delete_item(**kwargs)
  1. See DeleteItemInputRequestTypeDef

delete_table#

The DeleteTable operation deletes a table and all of its items.

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

# delete_table method definition

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

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

parent.delete_table(**kwargs)
  1. See DeleteTableInputRequestTypeDef

describe_backup#

Describes an existing backup of a table.

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

# describe_backup method definition

def describe_backup(
    self,
    *,
    BackupArn: str,
) -> DescribeBackupOutputTypeDef:  # (1)
    ...
  1. See DescribeBackupOutputTypeDef
# describe_backup method usage example with argument unpacking

kwargs: DescribeBackupInputRequestTypeDef = {  # (1)
    "BackupArn": ...,
}

parent.describe_backup(**kwargs)
  1. See DescribeBackupInputRequestTypeDef

describe_continuous_backups#

Checks the status of continuous backups and point in time recovery on the specified table.

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