DynamoDBServiceResource#
Auto-generated documentation for DynamoDB type annotations stubs module types-boto3-dynamodb.
DynamoDBServiceResource#
Type annotations and code completion for boto3.resource("dynamodb"), included resources and collections.
 boto3 documentation
# DynamoDBServiceResource usage example
from types_boto3_dynamodb.service_resource import DynamoDBServiceResource
def get_dynamodb_resource() -> DynamoDBServiceResource:
    return boto3.resource("dynamodb")Attributes#
- meta:- DynamoDBResourceMeta
- tables:- ServiceResourceTablesCollection
Collections#
ServiceResourceTablesCollection#
Provides access to Table resource.
Type annotations and code completion for boto3.resource("dynamodb").tables collection.
 boto3 documentation
# ServiceResourceTablesCollection usage example
from types_boto3_dynamodb.service_resource import ServiceResourceTablesCollection
def get_collection() -> ServiceResourceTablesCollection:
    return boto3.resource("dynamodb").tablesMethods#
DynamoDBServiceResource.get_available_subresources method#
Returns a list of all the available sub-resources for this resource.
Type annotations and code completion for boto3.resource("dynamodb").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...DynamoDBServiceResource.batch_get_item method#
The BatchGetItem operation returns the attributes of one or more
items from one or more tables.
Type annotations and code completion for boto3.resource("dynamodb").batch_get_item method.
 boto3 documentation
# batch_get_item method definition
def batch_get_item(
    self,
    *,
    RequestItems: Mapping[str, KeysAndAttributesServiceResourceUnionTypeDef],  # (1)
    ReturnConsumedCapacity: ReturnConsumedCapacityType = ...,  # (2)
) -> BatchGetItemOutputServiceResourceTypeDef:  # (3)
    ...- See Mapping[str, KeysAndAttributesServiceResourceUnionTypeDef]
- See ReturnConsumedCapacityType
- See BatchGetItemOutputServiceResourceTypeDef
# batch_get_item method usage example with argument unpacking
kwargs: BatchGetItemInputServiceResourceBatchGetItemTypeDef = {  # (1)
    "RequestItems": ...,
}
parent.batch_get_item(**kwargs)DynamoDBServiceResource.batch_write_item method#
The BatchWriteItem operation puts or deletes multiple items in one
or more tables.
Type annotations and code completion for boto3.resource("dynamodb").batch_write_item method.
 boto3 documentation
# batch_write_item method definition
def batch_write_item(
    self,
    *,
    RequestItems: Mapping[str, Sequence[WriteRequestServiceResourceUnionTypeDef]],  # (1)
    ReturnConsumedCapacity: ReturnConsumedCapacityType = ...,  # (2)
    ReturnItemCollectionMetrics: ReturnItemCollectionMetricsType = ...,  # (3)
) -> BatchWriteItemOutputServiceResourceTypeDef:  # (4)
    ...- See Mapping[str, Sequence[WriteRequestServiceResourceUnionTypeDef]]
- See ReturnConsumedCapacityType
- See ReturnItemCollectionMetricsType
- See BatchWriteItemOutputServiceResourceTypeDef
# batch_write_item method usage example with argument unpacking
kwargs: BatchWriteItemInputServiceResourceBatchWriteItemTypeDef = {  # (1)
    "RequestItems": ...,
}
parent.batch_write_item(**kwargs)DynamoDBServiceResource.create_table method#
The CreateTable operation adds a new table to your account.
Type annotations and code completion for boto3.resource("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[GlobalSecondaryIndexUnionTypeDef] = ...,  # (4)
    BillingMode: BillingModeType = ...,  # (5)
    ProvisionedThroughput: ProvisionedThroughputTypeDef = ...,  # (6)
    StreamSpecification: StreamSpecificationTypeDef = ...,  # (7)
    SSESpecification: SSESpecificationTypeDef = ...,  # (8)
    Tags: Sequence[TagTypeDef] = ...,  # (9)
    TableClass: TableClassType = ...,  # (10)
    DeletionProtectionEnabled: bool = ...,
    WarmThroughput: WarmThroughputTypeDef = ...,  # (11)
    ResourcePolicy: str = ...,
    OnDemandThroughput: OnDemandThroughputTypeDef = ...,  # (12)
) -> _Table:
    ...- See Sequence[AttributeDefinitionTypeDef]
- See Sequence[KeySchemaElementTypeDef]
- See Sequence[LocalSecondaryIndexTypeDef]
- See Sequence[GlobalSecondaryIndexUnionTypeDef]
- See BillingModeType
- See ProvisionedThroughputTypeDef
- See StreamSpecificationTypeDef
- See SSESpecificationTypeDef
- See Sequence[TagTypeDef]
- See TableClassType
- See WarmThroughputTypeDef
- See OnDemandThroughputTypeDef
# create_table method usage example with argument unpacking
kwargs: CreateTableInputServiceResourceCreateTableTypeDef = {  # (1)
    "AttributeDefinitions": ...,
    "TableName": ...,
    "KeySchema": ...,
}
parent.create_table(**kwargs)DynamoDBServiceResource.Table method#
Creates a Table resource.
Type annotations and code completion for boto3.resource("dynamodb").Table method.
 boto3 documentation
# Table method definition
def Table(
    self,
    name: str,
) -> _Table:
    ...Table#
Type annotations and code completion for boto3.resource("dynamodb").Table class.
 boto3 documentation
# Table usage example
from types_boto3_dynamodb.service_resource import Table
def get_resource() -> Table:
    return boto3.resource("dynamodb").Table(...)Table attributes#
- name:- str
- attribute_definitions:- List[AttributeDefinitionTypeDef]
- table_name:- str
- key_schema:- List[KeySchemaElementTypeDef]
- table_status: TableStatusType
- creation_date_time:- datetime.datetime
- provisioned_throughput: ProvisionedThroughputDescriptionTypeDef
- table_size_bytes:- int
- item_count:- int
- table_arn:- str
- table_id:- str
- billing_mode_summary: BillingModeSummaryTypeDef
- local_secondary_indexes:- List[LocalSecondaryIndexDescriptionTypeDef]
- global_secondary_indexes:- List[GlobalSecondaryIndexDescriptionTypeDef]
- stream_specification: StreamSpecificationTypeDef
- latest_stream_label:- str
- latest_stream_arn:- str
- global_table_version:- str
- replicas:- List[ReplicaDescriptionTypeDef]
- global_table_witnesses:- List[GlobalTableWitnessDescriptionTypeDef]
- restore_summary: RestoreSummaryTypeDef
- sse_description: SSEDescriptionTypeDef
- archival_summary: ArchivalSummaryTypeDef
- table_class_summary: TableClassSummaryTypeDef
- deletion_protection_enabled:- bool
- on_demand_throughput: OnDemandThroughputTypeDef
- warm_throughput: TableWarmThroughputDescriptionTypeDef
- multi_region_consistency: MultiRegionConsistencyType
- meta:- DynamoDBResourceMeta
Table methods#
Table.get_available_subresources method#
Returns a list of all the available sub-resources for this Table.
Type annotations and code completion for boto3.resource("dynamodb").get_available_subresources method.
 boto3 documentation
# get_available_subresources method definition
def get_available_subresources(
    self,
) -> Sequence[str]:
    ...Table.delete method#
The DeleteTable operation deletes a table and all of its items.
Type annotations and code completion for boto3.resource("dynamodb").delete method.
 boto3 documentation
# delete method definition
def delete(
    self,
) -> DeleteTableOutputTypeDef:  # (1)
    ...Table.delete_item method#
Deletes a single item in a table by primary key.
Type annotations and code completion for boto3.resource("dynamodb").delete_item method.
 boto3 documentation
# delete_item method definition
def delete_item(
    self,
    *,
    Key: Mapping[str, TableAttributeValueTypeDef],
    Expected: Mapping[str, ExpectedAttributeValueTableTypeDef] = ...,  # (1)
    ConditionalOperator: ConditionalOperatorType = ...,  # (2)
    ReturnValues: ReturnValueType = ...,  # (3)
    ReturnConsumedCapacity: ReturnConsumedCapacityType = ...,  # (4)
    ReturnItemCollectionMetrics: ReturnItemCollectionMetricsType = ...,  # (5)
    ConditionExpression: ConditionBaseImportTypeDef = ...,
    ExpressionAttributeNames: Mapping[str, str] = ...,
    ExpressionAttributeValues: Mapping[str, TableAttributeValueTypeDef] = ...,
    ReturnValuesOnConditionCheckFailure: ReturnValuesOnConditionCheckFailureType = ...,  # (6)
) -> DeleteItemOutputTableTypeDef:  # (7)
    ...- See Mapping[str, ExpectedAttributeValueTableTypeDef]
- See ConditionalOperatorType
- See ReturnValueType
- See ReturnConsumedCapacityType
- See ReturnItemCollectionMetricsType
- See ReturnValuesOnConditionCheckFailureType
- See DeleteItemOutputTableTypeDef
# delete_item method usage example with argument unpacking
kwargs: DeleteItemInputTableDeleteItemTypeDef = {  # (1)
    "Key": ...,
}
parent.delete_item(**kwargs)Table.get_item method#
The GetItem operation returns a set of attributes for the item
with the given primary key.
Type annotations and code completion for boto3.resource("dynamodb").get_item method.
 boto3 documentation
# get_item method definition
def get_item(
    self,
    *,
    Key: Mapping[str, TableAttributeValueTypeDef],
    AttributesToGet: Sequence[str] = ...,
    ConsistentRead: bool = ...,
    ReturnConsumedCapacity: ReturnConsumedCapacityType = ...,  # (1)
    ProjectionExpression: str = ...,
    ExpressionAttributeNames: Mapping[str, str] = ...,
) -> GetItemOutputTableTypeDef:  # (2)
    ...# get_item method usage example with argument unpacking
kwargs: GetItemInputTableGetItemTypeDef = {  # (1)
    "Key": ...,
}
parent.get_item(**kwargs)Table.put_item method#
Creates a new item, or replaces an old item with a new item.
Type annotations and code completion for boto3.resource("dynamodb").put_item method.
 boto3 documentation
# put_item method definition
def put_item(
    self,
    *,
    Item: Mapping[str, TableAttributeValueTypeDef],
    Expected: Mapping[str, ExpectedAttributeValueTableTypeDef] = ...,  # (1)
    ReturnValues: ReturnValueType = ...,  # (2)
    ReturnConsumedCapacity: ReturnConsumedCapacityType = ...,  # (3)
    ReturnItemCollectionMetrics: ReturnItemCollectionMetricsType = ...,  # (4)
    ConditionalOperator: ConditionalOperatorType = ...,  # (5)
    ConditionExpression: ConditionBaseImportTypeDef = ...,
    ExpressionAttributeNames: Mapping[str, str] = ...,
    ExpressionAttributeValues: Mapping[str, TableAttributeValueTypeDef] = ...,
    ReturnValuesOnConditionCheckFailure: ReturnValuesOnConditionCheckFailureType = ...,  # (6)
) -> PutItemOutputTableTypeDef:  # (7)
    ...- See Mapping[str, ExpectedAttributeValueTableTypeDef]
- See ReturnValueType
- See ReturnConsumedCapacityType
- See ReturnItemCollectionMetricsType
- See ConditionalOperatorType
- See ReturnValuesOnConditionCheckFailureType
- See PutItemOutputTableTypeDef
# put_item method usage example with argument unpacking
kwargs: PutItemInputTablePutItemTypeDef = {  # (1)
    "Item": ...,
}
parent.put_item(**kwargs)Table.query method#
You must provide the name of the partition key attribute and a single value for that attribute.
Type annotations and code completion for boto3.resource("dynamodb").query method.
 boto3 documentation
# query method definition
def query(
    self,
    *,
    IndexName: str = ...,
    Select: SelectType = ...,  # (1)
    AttributesToGet: Sequence[str] = ...,
    Limit: int = ...,
    ConsistentRead: bool = ...,
    KeyConditions: Mapping[str, ConditionTableTypeDef] = ...,  # (2)
    QueryFilter: Mapping[str, ConditionTableTypeDef] = ...,  # (2)
    ConditionalOperator: ConditionalOperatorType = ...,  # (4)
    ScanIndexForward: bool = ...,
    ExclusiveStartKey: Mapping[str, TableAttributeValueTypeDef] = ...,
    ReturnConsumedCapacity: ReturnConsumedCapacityType = ...,  # (5)
    ProjectionExpression: str = ...,
    FilterExpression: ConditionBaseImportTypeDef = ...,
    KeyConditionExpression: ConditionBaseImportTypeDef = ...,
    ExpressionAttributeNames: Mapping[str, str] = ...,
    ExpressionAttributeValues: Mapping[str, TableAttributeValueTypeDef] = ...,
) -> QueryOutputTableTypeDef:  # (6)
    ...- See SelectType
- See Mapping[str, ConditionTableTypeDef]
- See Mapping[str, ConditionTableTypeDef]
- See ConditionalOperatorType
- See ReturnConsumedCapacityType
- See QueryOutputTableTypeDef
# query method usage example with argument unpacking
kwargs: QueryInputTableQueryTypeDef = {  # (1)
    "IndexName": ...,
}
parent.query(**kwargs)Table.scan method#
The Scan operation returns one or more items and item attributes
by accessing every item in a table or a secondary index.
Type annotations and code completion for boto3.resource("dynamodb").scan method.
 boto3 documentation
# scan method definition
def scan(
    self,
    *,
    IndexName: str = ...,
    AttributesToGet: Sequence[str] = ...,
    Limit: int = ...,
    Select: SelectType = ...,  # (1)
    ScanFilter: Mapping[str, ConditionTableTypeDef] = ...,  # (2)
    ConditionalOperator: ConditionalOperatorType = ...,  # (3)
    ExclusiveStartKey: Mapping[str, TableAttributeValueTypeDef] = ...,
    ReturnConsumedCapacity: ReturnConsumedCapacityType = ...,  # (4)
    TotalSegments: int = ...,
    Segment: int = ...,
    ProjectionExpression: str = ...,
    FilterExpression: ConditionBaseImportTypeDef = ...,
    ExpressionAttributeNames: Mapping[str, str] = ...,
    ExpressionAttributeValues: Mapping[str, TableAttributeValueTypeDef] = ...,
    ConsistentRead: bool = ...,
) -> ScanOutputTableTypeDef:  # (5)
    ...- See SelectType
- See Mapping[str, ConditionTableTypeDef]
- See ConditionalOperatorType
- See ReturnConsumedCapacityType
- See ScanOutputTableTypeDef
# scan method usage example with argument unpacking
kwargs: ScanInputTableScanTypeDef = {  # (1)
    "IndexName": ...,
}
parent.scan(**kwargs)Table.update method#
Modifies the provisioned throughput settings, global secondary indexes, or DynamoDB Streams settings for a given table.
Type annotations and code completion for boto3.resource("dynamodb").update method.
 boto3 documentation
# update method definition
def update(
    self,
    *,
    AttributeDefinitions: Sequence[AttributeDefinitionTypeDef] = ...,  # (1)
    BillingMode: BillingModeType = ...,  # (2)
    ProvisionedThroughput: ProvisionedThroughputTypeDef = ...,  # (3)
    GlobalSecondaryIndexUpdates: Sequence[GlobalSecondaryIndexUpdateTypeDef] = ...,  # (4)
    StreamSpecification: StreamSpecificationTypeDef = ...,  # (5)
    SSESpecification: SSESpecificationTypeDef = ...,  # (6)
    ReplicaUpdates: Sequence[ReplicationGroupUpdateTypeDef] = ...,  # (7)
    TableClass: TableClassType = ...,  # (8)
    DeletionProtectionEnabled: bool = ...,
    MultiRegionConsistency: MultiRegionConsistencyType = ...,  # (9)
    GlobalTableWitnessUpdates: Sequence[GlobalTableWitnessGroupUpdateTypeDef] = ...,  # (10)
    OnDemandThroughput: OnDemandThroughputTypeDef = ...,  # (11)
    WarmThroughput: WarmThroughputTypeDef = ...,  # (12)
) -> _Table:
    ...- See Sequence[AttributeDefinitionTypeDef]
- See BillingModeType
- See ProvisionedThroughputTypeDef
- See Sequence[GlobalSecondaryIndexUpdateTypeDef]
- See StreamSpecificationTypeDef
- See SSESpecificationTypeDef
- See Sequence[ReplicationGroupUpdateTypeDef]
- See TableClassType
- See MultiRegionConsistencyType
- See Sequence[GlobalTableWitnessGroupUpdateTypeDef]
- See OnDemandThroughputTypeDef
- See WarmThroughputTypeDef
# update method usage example with argument unpacking
kwargs: UpdateTableInputTableUpdateTypeDef = {  # (1)
    "AttributeDefinitions": ...,
}
parent.update(**kwargs)Table.update_item method#
Edits an existing item's attributes, or adds a new item to the table if it does not already exist.
Type annotations and code completion for boto3.resource("dynamodb").update_item method.
 boto3 documentation
# update_item method definition
def update_item(
    self,
    *,
    Key: Mapping[str, TableAttributeValueTypeDef],
    AttributeUpdates: Mapping[str, AttributeValueUpdateTableTypeDef] = ...,  # (1)
    Expected: Mapping[str, ExpectedAttributeValueTableTypeDef] = ...,  # (2)
    ConditionalOperator: ConditionalOperatorType = ...,  # (3)
    ReturnValues: ReturnValueType = ...,  # (4)
    ReturnConsumedCapacity: ReturnConsumedCapacityType = ...,  # (5)
    ReturnItemCollectionMetrics: ReturnItemCollectionMetricsType = ...,  # (6)
    UpdateExpression: str = ...,
    ConditionExpression: ConditionBaseImportTypeDef = ...,
    ExpressionAttributeNames: Mapping[str, str] = ...,
    ExpressionAttributeValues: Mapping[str, TableAttributeValueTypeDef] = ...,
    ReturnValuesOnConditionCheckFailure: ReturnValuesOnConditionCheckFailureType = ...,  # (7)
) -> UpdateItemOutputTableTypeDef:  # (8)
    ...- See Mapping[str, AttributeValueUpdateTableTypeDef]
- See Mapping[str, ExpectedAttributeValueTableTypeDef]
- See ConditionalOperatorType
- See ReturnValueType
- See ReturnConsumedCapacityType
- See ReturnItemCollectionMetricsType
- See ReturnValuesOnConditionCheckFailureType
- See UpdateItemOutputTableTypeDef
# update_item method usage example with argument unpacking
kwargs: UpdateItemInputTableUpdateItemTypeDef = {  # (1)
    "Key": ...,
}
parent.update_item(**kwargs)Table.wait_until_exists method#
Waits until Table is exists.
Type annotations and code completion for boto3.resource("dynamodb").wait_until_exists method.
 boto3 documentation
# wait_until_exists method definition
def wait_until_exists(
    self,
) -> None:
    ...Table.wait_until_not_exists method#
Waits until Table is not_exists.
Type annotations and code completion for boto3.resource("dynamodb").wait_until_not_exists method.
 boto3 documentation
# wait_until_not_exists method definition
def wait_until_not_exists(
    self,
) -> None:
    ...Table.batch_writer method#
Create a batch writer object.
Type annotations and code completion for boto3.resource("dynamodb").batch_writer method.
 boto3 documentation
# batch_writer method definition
def batch_writer(
    self,
    overwrite_by_pkeys: List[str] = ...,
) -> boto3.dynamodb.table.BatchWriter:
    ...# batch_writer method usage example with argument unpacking
kwargs: TableBatchWriterRequestTypeDef = {  # (1)
    "overwrite_by_pkeys": ...,
}
parent.batch_writer(**kwargs)Table.load method#
Type annotations and code completion for boto3.resource("dynamodb").load method.
 boto3 documentation
# load method definition
def load(
    self,
) -> None:
    ...Table.reload method#
Type annotations and code completion for boto3.resource("dynamodb").reload method.
 boto3 documentation
# reload method definition
def reload(
    self,
) -> None:
    ...