Class Table
- java.lang.Object
-
- com.amazonaws.services.dynamodbv2.document.Table
-
- All Implemented Interfaces:
DeleteItemApi
,GetItemApi
,PutItemApi
,QueryApi
,ScanApi
,UpdateItemApi
public class Table extends Object implements PutItemApi, GetItemApi, QueryApi, ScanApi, UpdateItemApi, DeleteItemApi
A DynamoDB table. Instance of this class is typically obtained viaDynamoDB.getTable(String)
.
-
-
Constructor Summary
Constructors Constructor Description Table(AmazonDynamoDB client, String tableName)
Table(AmazonDynamoDB client, String tableName, TableDescription tableDescription)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Index
createGSI(CreateGlobalSecondaryIndexAction create, AttributeDefinition hashKeyDefinition)
Creates a global secondary index (GSI) with only a hash key on this table.Index
createGSI(CreateGlobalSecondaryIndexAction create, AttributeDefinition hashKeyDefinition, AttributeDefinition rangeKeyDefinition)
Creates a global secondary index (GSI) with both a hash key and a range key on this table.DeleteTableResult
delete()
Deletes the table from DynamoDB.DeleteItemOutcome
deleteItem(KeyAttribute... primaryKeyComponents)
Deletes an item by primary key.DeleteItemOutcome
deleteItem(PrimaryKey primaryKey)
Deletes an item by primary key.DeleteItemOutcome
deleteItem(PrimaryKey primaryKey, Expected... expected)
Conditional delete with the specified primary key and expected conditions.DeleteItemOutcome
deleteItem(PrimaryKey primaryKey, DeleteItemExpressionSpec conditionExpressions)
DeleteItemOutcome
deleteItem(PrimaryKey primaryKey, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Conditional delete with the specified primary key and condition expression.DeleteItemOutcome
deleteItem(DeleteItemSpec spec)
Deletes an item by specifying all the details.DeleteItemOutcome
deleteItem(String hashKeyName, Object hashKeyValue)
Deletes an item by hash-only primary key.DeleteItemOutcome
deleteItem(String hashKeyName, Object hashKeyValue, Expected... expected)
Conditional delete with the specified hash-only primary key and expected conditions.DeleteItemOutcome
deleteItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue)
Deletes an item by hash key-and-range primary key.DeleteItemOutcome
deleteItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, Expected... expected)
Conditional delete with the specified hash-and-range primary key and expected conditions.DeleteItemOutcome
deleteItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, DeleteItemExpressionSpec conditionExpressions)
DeleteItemOutcome
deleteItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Conditional delete with the specified hash-and-range primary key and condition expression.DeleteItemOutcome
deleteItem(String hashKeyName, Object hashKeyValue, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Conditional delete with the specified hash-only primary key and condition expression.TableDescription
describe()
Retrieves the table description from DynamoDB.TableDescription
getDescription()
Returns the table description; or null if the table description has not yet been described viadescribe()
.Index
getIndex(String indexName)
Gets a reference to the specified index.Item
getItem(KeyAttribute... primaryKeyComponents)
Retrieves an item by primary key.Item
getItem(PrimaryKey primaryKey)
Retrieves an item by primary key; or null if the item doesn't exist.Item
getItem(PrimaryKey primaryKey, String projectionExpression, Map<String,String> nameMap)
Retrieves an item using projection expression.Item
getItem(GetItemSpec spec)
Retrieves an item by specifying all the details.Item
getItem(String hashKeyName, Object hashKeyValue)
Retrieves an item by primary key when the primary key is a hash-only key.Item
getItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue)
Retrieves an item by primary key when the primary key consists of both a hash-key and a range-key.Item
getItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, GetItemExpressionSpec projectionExpressions)
Item
getItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String projectionExpression, Map<String,String> nameMap)
Retrieves an item via the specified hash key and range key using projection expression.Item
getItem(String hashKeyName, Object hashKeyValue, String projectionExpression, Map<String,String> nameMap)
Retrieves an item via the specified hash key using projection expression.GetItemOutcome
getItemOutcome(KeyAttribute... primaryKeyComponents)
Retrieves an item and the associated information by primary key when the primary key is a hash-only key.GetItemOutcome
getItemOutcome(PrimaryKey primaryKey)
Retrieves an item and the associated information by primary key.GetItemOutcome
getItemOutcome(PrimaryKey primaryKey, String projectionExpression, Map<String,String> nameMap)
Retrieves an item and the associated information using projection expression.GetItemOutcome
getItemOutcome(GetItemSpec params)
Retrieves an item and the associated information by specifying all the details.GetItemOutcome
getItemOutcome(String hashKeyName, Object hashKeyValue)
Retrieves an item and the associated information by primary key when the primary key is a hash-only key.GetItemOutcome
getItemOutcome(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue)
Retrieves an item and the associated information by primary key when the primary key consists of both a hash-key and a range-key.GetItemOutcome
getItemOutcome(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, GetItemExpressionSpec projectionExpressions)
GetItemOutcome
getItemOutcome(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String projectionExpression, Map<String,String> nameMap)
Retrieves an item and the associated information via the specified hash key and range key using projection expression.GetItemOutcome
getItemOutcome(String hashKeyName, Object hashKeyValue, String projectionExpression, Map<String,String> nameMap)
Retrieves an item and the associated information via the specified hash key using projection expression.String
getTableName()
PutItemOutcome
putItem(Item item)
Unconditional put.PutItemOutcome
putItem(Item item, Expected... expected)
Conditional put.PutItemOutcome
putItem(Item item, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Conditional put via condition expression.PutItemOutcome
putItem(PutItemSpec spec)
Puts an item by specifying all the details.ItemCollection<QueryOutcome>
query(KeyAttribute hashKey)
Retrieves items by the specified hash key.ItemCollection<QueryOutcome>
query(KeyAttribute hashKey, RangeKeyCondition rangeKeyCondition)
Retrieves items by the specified hash key and a range key condition.ItemCollection<QueryOutcome>
query(KeyAttribute hashKey, RangeKeyCondition rangeKeyCondition, QueryFilter... queryFilters)
Retrieves items by the specified hash key, a range key condition and a list of query filters.ItemCollection<QueryOutcome>
query(KeyAttribute hashKey, RangeKeyCondition rangeKeyCondition, String filterExpression, String projectionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Retrieves items by the specified hash key, a range key condition, a filter expression and a projection expression.ItemCollection<QueryOutcome>
query(KeyAttribute hashKey, RangeKeyCondition rangeKeyCondition, String filterExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Retrieves items by the specified hash key, a range key condition, and a filter expression string.ItemCollection<QueryOutcome>
query(QuerySpec spec)
Queries table by specifying all the details.ItemCollection<QueryOutcome>
query(String hashKeyName, Object hashKeyValue)
Retrieves items by the specified hash key.ItemCollection<QueryOutcome>
query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition)
ItemCollection<QueryOutcome>
query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition, QueryFilter... queryFilters)
ItemCollection<QueryOutcome>
query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition, QueryExpressionSpec queryExpressions)
ItemCollection<QueryOutcome>
query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition, String filterExpression, String projectionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Retrieves items by the specified hash key, a range key condition, a filter expression and a projection expression.ItemCollection<QueryOutcome>
query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition, String filterExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
ItemCollection<ScanOutcome>
scan(ScanFilter... scanFilters)
Retrieves items by the specified list of scan filters.ItemCollection<ScanOutcome>
scan(ScanSpec params)
Scans table by specifying all the details.ItemCollection<ScanOutcome>
scan(ScanExpressionSpec scanExpressions)
ItemCollection<ScanOutcome>
scan(String filterExpression, String projectionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Scans table using a Filter Expression and a Projection Expression.ItemCollection<ScanOutcome>
scan(String filterExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Scans table using a Filter Expression.String
toString()
UpdateItemOutcome
updateItem(PrimaryKey primaryKey, AttributeUpdate... attributeUpdates)
Updates an item with the attributes specified.UpdateItemOutcome
updateItem(PrimaryKey primaryKey, String updateExpression, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Updates an item with the specified primary key using the given update expression provided the condition expression evaluates to true.UpdateItemOutcome
updateItem(PrimaryKey primaryKey, String updateExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Performs an update on an item in the table using the given update expression string.UpdateItemOutcome
updateItem(PrimaryKey primaryKey, Collection<Expected> expected, AttributeUpdate... attributeUpdates)
Updates an item with the attributes specified.UpdateItemOutcome
updateItem(UpdateItemSpec updateItemSpec)
Performs an update on an item in the table by specifying all the details.UpdateItemOutcome
updateItem(String hashKeyName, Object hashKeyValue, AttributeUpdate... attributeUpdates)
UpdateItemOutcome
updateItem(String hashKeyName, Object hashKeyValue, UpdateItemExpressionSpec updateExpressions)
UpdateItemOutcome
updateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, AttributeUpdate... attributeUpdates)
UpdateItemOutcome
updateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, UpdateItemExpressionSpec updateExpressions)
UpdateItemOutcome
updateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String updateExpression, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Updates an item with the specified hash key and range key using the given update expression provided the condition expression evaluates to true.UpdateItemOutcome
updateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String updateExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
UpdateItemOutcome
updateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, Collection<Expected> expected, AttributeUpdate... attributeUpdates)
Updates an item with the specified hash key, range key and attributes.UpdateItemOutcome
updateItem(String hashKeyName, Object hashKeyValue, String updateExpression, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Updates an item with the specified hash key using the given update expression provided the condition expression evaluates to true.UpdateItemOutcome
updateItem(String hashKeyName, Object hashKeyValue, String updateExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
UpdateItemOutcome
updateItem(String hashKeyName, Object hashKeyValue, Collection<Expected> expected, AttributeUpdate... attributeUpdates)
Updates an item with the specified hash-only key and attributes.TableDescription
updateTable(UpdateTableSpec spec)
Updates the provisioned throughput for this table.TableDescription
updateTable(ProvisionedThroughput provisionedThroughput)
Updates the provisioned throughput for this table.TableDescription
waitForActive()
A convenient blocking call that can be used, typically during table creation, to wait for the table to become active by polling the table every 5 seconds.TableDescription
waitForActiveOrDelete()
A convenient blocking call that can be used to wait on a table until it has either become active or deleted (ie no longer exists) by polling the table every 5 seconds.TableDescription
waitForAllActiveOrDelete()
A convenient blocking call that can be used to wait on a table and all it's indexes until both the table and it's indexes have either become active or deleted (ie no longer exists) by polling the table every 5 seconds.void
waitForDelete()
A convenient blocking call that can be used, typically during table deletion, to wait for the table to become deleted by polling the table every 5 seconds.
-
-
-
Constructor Detail
-
Table
public Table(AmazonDynamoDB client, String tableName)
-
Table
public Table(AmazonDynamoDB client, String tableName, TableDescription tableDescription)
-
-
Method Detail
-
getTableName
public String getTableName()
-
getDescription
public TableDescription getDescription()
Returns the table description; or null if the table description has not yet been described viadescribe()
. No network call.
-
describe
public TableDescription describe()
Retrieves the table description from DynamoDB. Involves network calls. Meant to be called as infrequently as possible to avoid throttling exception from the server side.- Returns:
- a non-null table description
- Throws:
ResourceNotFoundException
- if the table doesn't exist
-
getIndex
public Index getIndex(String indexName)
Gets a reference to the specified index. No network call.
-
putItem
public PutItemOutcome putItem(Item item)
Description copied from interface:PutItemApi
Unconditional put.- Specified by:
putItem
in interfacePutItemApi
-
putItem
public PutItemOutcome putItem(Item item, Expected... expected)
Description copied from interface:PutItemApi
Conditional put.- Specified by:
putItem
in interfacePutItemApi
-
putItem
public PutItemOutcome putItem(Item item, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:PutItemApi
Conditional put via condition expression.- Specified by:
putItem
in interfacePutItemApi
-
putItem
public PutItemOutcome putItem(PutItemSpec spec)
Description copied from interface:PutItemApi
Puts an item by specifying all the details.- Specified by:
putItem
in interfacePutItemApi
-
getItemOutcome
public GetItemOutcome getItemOutcome(KeyAttribute... primaryKeyComponents)
Description copied from interface:GetItemApi
Retrieves an item and the associated information by primary key when the primary key is a hash-only key. Incurs network access.- Specified by:
getItemOutcome
in interfaceGetItemApi
- Returns:
- the (non-null) result of item retrieval.
-
getItemOutcome
public GetItemOutcome getItemOutcome(PrimaryKey primaryKey)
Description copied from interface:GetItemApi
Retrieves an item and the associated information by primary key. Incurs network access.- Specified by:
getItemOutcome
in interfaceGetItemApi
- Returns:
- the (non-null) result of item retrieval.
-
getItemOutcome
public GetItemOutcome getItemOutcome(PrimaryKey primaryKey, String projectionExpression, Map<String,String> nameMap)
Description copied from interface:GetItemApi
Retrieves an item and the associated information using projection expression. Incurs network access.- Specified by:
getItemOutcome
in interfaceGetItemApi
projectionExpression
- projection expression, example: "a.b , c[0].e"nameMap
- actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.- Returns:
- the (non-null) result of item retrieval.
-
getItemOutcome
public GetItemOutcome getItemOutcome(GetItemSpec params)
Description copied from interface:GetItemApi
Retrieves an item and the associated information by specifying all the details. Incurs network access.- Specified by:
getItemOutcome
in interfaceGetItemApi
- Returns:
- the (non-null) result of item retrieval.
-
updateItem
public UpdateItemOutcome updateItem(PrimaryKey primaryKey, AttributeUpdate... attributeUpdates)
Description copied from interface:UpdateItemApi
Updates an item with the attributes specified.- Specified by:
updateItem
in interfaceUpdateItemApi
- Parameters:
primaryKey
- primary key of the item to be updatedattributeUpdates
- attributes to be updated
-
updateItem
public UpdateItemOutcome updateItem(PrimaryKey primaryKey, Collection<Expected> expected, AttributeUpdate... attributeUpdates)
Description copied from interface:UpdateItemApi
Updates an item with the attributes specified.- Specified by:
updateItem
in interfaceUpdateItemApi
- Parameters:
primaryKey
- primary key of the item to be updatedexpected
- the condition to match for the update to succeed.attributeUpdates
- attributes to be updated
-
updateItem
public UpdateItemOutcome updateItem(PrimaryKey primaryKey, String updateExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:UpdateItemApi
Performs an update on an item in the table using the given update expression string.- Specified by:
updateItem
in interfaceUpdateItemApi
- Parameters:
primaryKey
- primary key of the item to be updatedupdateExpression
- the update expression that specifies the attributes to be updated.nameMap
- the map containing the mapping between attribute names used in update expression and the actual name of the attributesvalueMap
- the map containing the mapping between the attribute value used in update expression and the actual value of the attribute
-
updateItem
public UpdateItemOutcome updateItem(PrimaryKey primaryKey, String updateExpression, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:UpdateItemApi
Updates an item with the specified primary key using the given update expression provided the condition expression evaluates to true.- Specified by:
updateItem
in interfaceUpdateItemApi
- Parameters:
primaryKey
- primary key of the item to be updatedupdateExpression
- the update expression that specifies the attributes to be updated.conditionExpression
- the condition expression that specifies the condition that needs to be evaluated to truenameMap
- the map containing the mapping between attribute names used in update and condition expression and the actual name of the attributesvalueMap
- the map containing the mapping between the attribute value used in update and condition expression and the actual value of the attribute
-
updateItem
public UpdateItemOutcome updateItem(UpdateItemSpec updateItemSpec)
Description copied from interface:UpdateItemApi
Performs an update on an item in the table by specifying all the details.- Specified by:
updateItem
in interfaceUpdateItemApi
- Parameters:
updateItemSpec
- the update specification for the item to be updated.
-
query
public ItemCollection<QueryOutcome> query(String hashKeyName, Object hashKeyValue)
Description copied from interface:QueryApi
Retrieves items by the specified hash key.
-
query
public ItemCollection<QueryOutcome> query(KeyAttribute hashKey)
Description copied from interface:QueryApi
Retrieves items by the specified hash key.
-
query
public ItemCollection<QueryOutcome> query(KeyAttribute hashKey, RangeKeyCondition rangeKeyCondition)
Description copied from interface:QueryApi
Retrieves items by the specified hash key and a range key condition.
-
query
public ItemCollection<QueryOutcome> query(KeyAttribute hashKey, RangeKeyCondition rangeKeyCondition, String filterExpression, String projectionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:QueryApi
Retrieves items by the specified hash key, a range key condition, a filter expression and a projection expression.- Specified by:
query
in interfaceQueryApi
filterExpression
- filter expression example: "(#a > :a) AND (#c > :c OR #e < :e)"projectionExpression
- projection expression example: "a.b, c[0].e"nameMap
- actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.valueMap
- actual values for the value place holders can be null if there is no attribute-value placeholder.
-
query
public ItemCollection<QueryOutcome> query(KeyAttribute hashKey, RangeKeyCondition rangeKeyCondition, QueryFilter... queryFilters)
Description copied from interface:QueryApi
Retrieves items by the specified hash key, a range key condition and a list of query filters.
-
query
public ItemCollection<QueryOutcome> query(KeyAttribute hashKey, RangeKeyCondition rangeKeyCondition, String filterExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:QueryApi
Retrieves items by the specified hash key, a range key condition, and a filter expression string.- Specified by:
query
in interfaceQueryApi
filterExpression
- filter expression example: "(#a > :a) AND (#c > :c OR #e < :e)"nameMap
- actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.valueMap
- actual values for the value place holders can be null if there is no attribute-value placeholder.
-
query
public ItemCollection<QueryOutcome> query(QuerySpec spec)
Description copied from interface:QueryApi
Queries table by specifying all the details.
-
scan
public ItemCollection<ScanOutcome> scan(ScanFilter... scanFilters)
Description copied from interface:ScanApi
Retrieves items by the specified list of scan filters.
-
scan
public ItemCollection<ScanOutcome> scan(String filterExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:ScanApi
Scans table using a Filter Expression.- Specified by:
scan
in interfaceScanApi
- Parameters:
filterExpression
- condition expression example: "(#a > :a) AND (#c > :c OR #e < :e)"nameMap
- actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.valueMap
- actual values for the value place holders can be null if there is no attribute-value placeholder.
-
scan
public ItemCollection<ScanOutcome> scan(String filterExpression, String projectionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:ScanApi
Scans table using a Filter Expression and a Projection Expression.- Specified by:
scan
in interfaceScanApi
- Parameters:
filterExpression
- condition expression example: "(#a > :a) AND (#c > :c OR #e < :e)"projectionExpression
- projection expression example: "a.b , c[0].e"nameMap
- actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.valueMap
- actual values for the value place holders can be null if there is no attribute-value placeholder.
-
scan
public ItemCollection<ScanOutcome> scan(ScanSpec params)
Description copied from interface:ScanApi
Scans table by specifying all the details.
-
scan
@Beta public ItemCollection<ScanOutcome> scan(ScanExpressionSpec scanExpressions)
-
deleteItem
public DeleteItemOutcome deleteItem(KeyAttribute... primaryKeyComponents)
Description copied from interface:DeleteItemApi
Deletes an item by primary key.- Specified by:
deleteItem
in interfaceDeleteItemApi
-
deleteItem
public DeleteItemOutcome deleteItem(PrimaryKey primaryKey)
Description copied from interface:DeleteItemApi
Deletes an item by primary key.- Specified by:
deleteItem
in interfaceDeleteItemApi
-
deleteItem
public DeleteItemOutcome deleteItem(PrimaryKey primaryKey, Expected... expected)
Description copied from interface:DeleteItemApi
Conditional delete with the specified primary key and expected conditions.- Specified by:
deleteItem
in interfaceDeleteItemApi
-
deleteItem
public DeleteItemOutcome deleteItem(PrimaryKey primaryKey, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:DeleteItemApi
Conditional delete with the specified primary key and condition expression.- Specified by:
deleteItem
in interfaceDeleteItemApi
-
deleteItem
@Beta public DeleteItemOutcome deleteItem(PrimaryKey primaryKey, DeleteItemExpressionSpec conditionExpressions)
-
deleteItem
public DeleteItemOutcome deleteItem(DeleteItemSpec spec)
Description copied from interface:DeleteItemApi
Deletes an item by specifying all the details.- Specified by:
deleteItem
in interfaceDeleteItemApi
-
updateTable
public TableDescription updateTable(UpdateTableSpec spec)
Updates the provisioned throughput for this table. Setting the throughput for a table helps you manage performance and is part of the provisioned throughput feature of DynamoDB.The provisioned throughput values can be upgraded or downgraded based on the maximums and minimums listed in the Limits section in the Amazon DynamoDB Developer Guide.
This table must be in the
ACTIVE
state for this operation to succeed. UpdateTable is an asynchronous operation; while executing the operation, the table is in theUPDATING
state. While the table is in theUPDATING
state, the table still has the provisioned throughput from before the call. The new provisioned throughput setting is in effect only when the table returns to theACTIVE
state after the UpdateTable operation.You can create, update or delete indexes using UpdateTable.
- Parameters:
spec
- used to specify all the detailed parameters- Returns:
- the updated table description returned from DynamoDB.
-
createGSI
public Index createGSI(CreateGlobalSecondaryIndexAction create, AttributeDefinition hashKeyDefinition)
Creates a global secondary index (GSI) with only a hash key on this table. Involves network calls. This table must be in theACTIVE
state for this operation to succeed. Creating a global secondary index is an asynchronous operation; while executing the operation, the index is in theCREATING
state. Once created, the index will be inACTIVE
state.- Parameters:
create
- used to specify the details of the index creationhashKeyDefinition
- used to specify the attribute for describing the key schema for the hash key of the GSI to be created for this table.- Returns:
- the index being created
-
createGSI
public Index createGSI(CreateGlobalSecondaryIndexAction create, AttributeDefinition hashKeyDefinition, AttributeDefinition rangeKeyDefinition)
Creates a global secondary index (GSI) with both a hash key and a range key on this table. Involves network calls. This table must be in theACTIVE
state for this operation to succeed. Creating a global secondary index is an asynchronous operation; while executing the operation, the index is in theCREATING
state. Once created, the index will be inACTIVE
state.- Parameters:
create
- used to specify the details of the index creationhashKeyDefinition
- used to specify the attribute for describing the key schema for the hash key of the GSI to be created for this table.rangeKeyDefinition
- used to specify the attribute for describing the key schema for the range key of the GSI to be created for this table.- Returns:
- the index being created
-
updateTable
public TableDescription updateTable(ProvisionedThroughput provisionedThroughput)
Updates the provisioned throughput for this table. Setting the throughput for a table helps you manage performance and is part of the provisioned throughput feature of DynamoDB.The provisioned throughput values can be upgraded or downgraded based on the maximums and minimums listed in the Limits section in the Amazon DynamoDB Developer Guide.
This table must be in the
ACTIVE
state for this operation to succeed. UpdateTable is an asynchronous operation; while executing the operation, the table is in theUPDATING
state. While the table is in theUPDATING
state, the table still has the provisioned throughput from before the call. The new provisioned throughput setting is in effect only when the table returns to theACTIVE
state after the UpdateTable operation.You can create, update or delete indexes using UpdateTable.
- Parameters:
provisionedThroughput
- target provisioned throughput- Returns:
- the updated table description returned from DynamoDB.
-
waitForActive
public TableDescription waitForActive() throws InterruptedException
A convenient blocking call that can be used, typically during table creation, to wait for the table to become active by polling the table every 5 seconds.- Returns:
- the table description when the table has become active
- Throws:
IllegalArgumentException
- if the table is being deletedResourceNotFoundException
- if the table doesn't existInterruptedException
-
waitForDelete
public void waitForDelete() throws InterruptedException
A convenient blocking call that can be used, typically during table deletion, to wait for the table to become deleted by polling the table every 5 seconds.- Throws:
InterruptedException
-
waitForActiveOrDelete
public TableDescription waitForActiveOrDelete() throws InterruptedException
A convenient blocking call that can be used to wait on a table until it has either become active or deleted (ie no longer exists) by polling the table every 5 seconds.- Returns:
- the table description if the table has become active; or null if the table has been deleted.
- Throws:
InterruptedException
-
waitForAllActiveOrDelete
public TableDescription waitForAllActiveOrDelete() throws InterruptedException
A convenient blocking call that can be used to wait on a table and all it's indexes until both the table and it's indexes have either become active or deleted (ie no longer exists) by polling the table every 5 seconds.- Returns:
- the table description if the table and all it's indexes have become active; or null if the table has been deleted.
- Throws:
InterruptedException
-
delete
public DeleteTableResult delete()
Deletes the table from DynamoDB. Involves network calls.
-
getItem
public Item getItem(KeyAttribute... primaryKeyComponents)
Description copied from interface:GetItemApi
Retrieves an item by primary key. Incurs network access.- Specified by:
getItem
in interfaceGetItemApi
- Returns:
- the retrieved item; or null if the item doesn't exist.
-
getItem
public Item getItem(PrimaryKey primaryKey)
Description copied from interface:GetItemApi
Retrieves an item by primary key; or null if the item doesn't exist. Incurs network access.- Specified by:
getItem
in interfaceGetItemApi
- Returns:
- the retrieved item; or null if the item doesn't exist.
-
getItem
public Item getItem(PrimaryKey primaryKey, String projectionExpression, Map<String,String> nameMap)
Description copied from interface:GetItemApi
Retrieves an item using projection expression. Incurs network access.- Specified by:
getItem
in interfaceGetItemApi
projectionExpression
- projection expression, example: "a.b , c[0].e"nameMap
- actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.- Returns:
- the retrieved item; or null if the item doesn't exist.
-
getItem
public Item getItem(GetItemSpec spec)
Description copied from interface:GetItemApi
Retrieves an item by specifying all the details. Incurs network access.- Specified by:
getItem
in interfaceGetItemApi
- Returns:
- the retrieved item; or null if the item doesn't exist.
-
getItemOutcome
public GetItemOutcome getItemOutcome(String hashKeyName, Object hashKeyValue)
Description copied from interface:GetItemApi
Retrieves an item and the associated information by primary key when the primary key is a hash-only key. Incurs network access.- Specified by:
getItemOutcome
in interfaceGetItemApi
- Returns:
- the (non-null) result of item retrieval.
-
getItemOutcome
public GetItemOutcome getItemOutcome(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue)
Description copied from interface:GetItemApi
Retrieves an item and the associated information by primary key when the primary key consists of both a hash-key and a range-key. Incurs network access.- Specified by:
getItemOutcome
in interfaceGetItemApi
- Returns:
- the (non-null) result of item retrieval.
-
getItem
public Item getItem(String hashKeyName, Object hashKeyValue)
Description copied from interface:GetItemApi
Retrieves an item by primary key when the primary key is a hash-only key. Incurs network access.- Specified by:
getItem
in interfaceGetItemApi
- Returns:
- the retrieved item; or null if the item doesn't exist.
-
getItem
public Item getItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue)
Description copied from interface:GetItemApi
Retrieves an item by primary key when the primary key consists of both a hash-key and a range-key. Incurs network access.- Specified by:
getItem
in interfaceGetItemApi
- Returns:
- the retrieved item; or null if the item doesn't exist.
-
query
public ItemCollection<QueryOutcome> query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition)
-
query
public ItemCollection<QueryOutcome> query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition, QueryFilter... queryFilters)
-
query
public ItemCollection<QueryOutcome> query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition, String filterExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
-
query
public ItemCollection<QueryOutcome> query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition, String filterExpression, String projectionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:QueryApi
Retrieves items by the specified hash key, a range key condition, a filter expression and a projection expression.- Specified by:
query
in interfaceQueryApi
filterExpression
- filter expression example: "(#a > :a) AND (#c > :c OR #e < :e)"projectionExpression
- projection expression example: "a.b, c[0].e"nameMap
- actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.valueMap
- actual values for the value place holders can be null if there is no attribute-value placeholder.
-
query
@Beta public ItemCollection<QueryOutcome> query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition, QueryExpressionSpec queryExpressions)
-
updateItem
public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, AttributeUpdate... attributeUpdates)
- Specified by:
updateItem
in interfaceUpdateItemApi
-
updateItem
public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, AttributeUpdate... attributeUpdates)
- Specified by:
updateItem
in interfaceUpdateItemApi
-
updateItem
public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, Collection<Expected> expected, AttributeUpdate... attributeUpdates)
Description copied from interface:UpdateItemApi
Updates an item with the specified hash-only key and attributes.- Specified by:
updateItem
in interfaceUpdateItemApi
-
updateItem
public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, Collection<Expected> expected, AttributeUpdate... attributeUpdates)
Description copied from interface:UpdateItemApi
Updates an item with the specified hash key, range key and attributes.- Specified by:
updateItem
in interfaceUpdateItemApi
-
updateItem
public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, String updateExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
- Specified by:
updateItem
in interfaceUpdateItemApi
-
updateItem
public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String updateExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
- Specified by:
updateItem
in interfaceUpdateItemApi
-
updateItem
public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, String updateExpression, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:UpdateItemApi
Updates an item with the specified hash key using the given update expression provided the condition expression evaluates to true.- Specified by:
updateItem
in interfaceUpdateItemApi
-
updateItem
@Beta public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, UpdateItemExpressionSpec updateExpressions)
-
updateItem
public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String updateExpression, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:UpdateItemApi
Updates an item with the specified hash key and range key using the given update expression provided the condition expression evaluates to true.- Specified by:
updateItem
in interfaceUpdateItemApi
-
updateItem
@Beta public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, UpdateItemExpressionSpec updateExpressions)
-
getItemOutcome
public GetItemOutcome getItemOutcome(String hashKeyName, Object hashKeyValue, String projectionExpression, Map<String,String> nameMap)
Description copied from interface:GetItemApi
Retrieves an item and the associated information via the specified hash key using projection expression. Incurs network access.- Specified by:
getItemOutcome
in interfaceGetItemApi
- Returns:
- the (non-null) result of item retrieval.
-
getItemOutcome
public GetItemOutcome getItemOutcome(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String projectionExpression, Map<String,String> nameMap)
Description copied from interface:GetItemApi
Retrieves an item and the associated information via the specified hash key and range key using projection expression. Incurs network access.- Specified by:
getItemOutcome
in interfaceGetItemApi
- Returns:
- the (non-null) result of item retrieval.
-
getItemOutcome
@Beta public GetItemOutcome getItemOutcome(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, GetItemExpressionSpec projectionExpressions)
-
getItem
public Item getItem(String hashKeyName, Object hashKeyValue, String projectionExpression, Map<String,String> nameMap)
Description copied from interface:GetItemApi
Retrieves an item via the specified hash key using projection expression. Incurs network access.- Specified by:
getItem
in interfaceGetItemApi
- Returns:
- the retrieved item; or null if the item doesn't exist.
-
getItem
public Item getItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String projectionExpression, Map<String,String> nameMap)
Description copied from interface:GetItemApi
Retrieves an item via the specified hash key and range key using projection expression. Incurs network access.- Specified by:
getItem
in interfaceGetItemApi
- Returns:
- the retrieved item; or null if the item doesn't exist.
-
getItem
@Beta public Item getItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, GetItemExpressionSpec projectionExpressions)
-
deleteItem
public DeleteItemOutcome deleteItem(String hashKeyName, Object hashKeyValue)
Description copied from interface:DeleteItemApi
Deletes an item by hash-only primary key.- Specified by:
deleteItem
in interfaceDeleteItemApi
-
deleteItem
public DeleteItemOutcome deleteItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue)
Description copied from interface:DeleteItemApi
Deletes an item by hash key-and-range primary key.- Specified by:
deleteItem
in interfaceDeleteItemApi
-
deleteItem
public DeleteItemOutcome deleteItem(String hashKeyName, Object hashKeyValue, Expected... expected)
Description copied from interface:DeleteItemApi
Conditional delete with the specified hash-only primary key and expected conditions.- Specified by:
deleteItem
in interfaceDeleteItemApi
-
deleteItem
public DeleteItemOutcome deleteItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, Expected... expected)
Description copied from interface:DeleteItemApi
Conditional delete with the specified hash-and-range primary key and expected conditions.- Specified by:
deleteItem
in interfaceDeleteItemApi
-
deleteItem
public DeleteItemOutcome deleteItem(String hashKeyName, Object hashKeyValue, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:DeleteItemApi
Conditional delete with the specified hash-only primary key and condition expression.- Specified by:
deleteItem
in interfaceDeleteItemApi
-
deleteItem
public DeleteItemOutcome deleteItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:DeleteItemApi
Conditional delete with the specified hash-and-range primary key and condition expression.- Specified by:
deleteItem
in interfaceDeleteItemApi
-
deleteItem
@Beta public DeleteItemOutcome deleteItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, DeleteItemExpressionSpec conditionExpressions)
-
-