execute_statement¶
Operation¶
execute_statement
async
¶
execute_statement(input: ExecuteStatementInput, plugins: list[Plugin] | None = None) -> ExecuteStatementOutput
This operation allows you to perform reads and singleton writes on data stored in DynamoDB, using PartiQL.
For PartiQL reads (SELECT statement), if the total number of processed
items exceeds the maximum dataset size limit of 1 MB, the read stops and
results are returned to the user as a LastEvaluatedKey value to
continue the read in a subsequent operation. If the filter criteria in
WHERE clause does not match any data, the read will return an empty
result set.
A single SELECT statement response can return up to the maximum number
of items (if using the Limit parameter) or a maximum of 1 MB of data
(and then apply any filtering to the results using WHERE clause). If
LastEvaluatedKey is present in the response, you need to paginate the
result set. If NextToken is present, you need to paginate the result
set and include NextToken.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
ExecuteStatementInput
|
An instance of |
required |
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
Returns:
| Type | Description |
|---|---|
ExecuteStatementOutput
|
An instance of |
Input¶
ExecuteStatementInput
dataclass
¶
Dataclass for ExecuteStatementInput structure.
Attributes¶
consistent_read
class-attribute
instance-attribute
¶
consistent_read: bool | None = None
The consistency of a read operation. If set to true, then a strongly
consistent read is used; otherwise, an eventually consistent read is
used.
limit
class-attribute
instance-attribute
¶
limit: int | None = None
The maximum number of items to evaluate (not necessarily the number of
matching items). If DynamoDB processes the number of items up to the
limit while processing the results, it stops the operation and returns
the matching values up to that point, along with a key in
LastEvaluatedKey to apply in a subsequent operation so you can pick up
where you left off. Also, if the processed dataset size exceeds 1 MB
before DynamoDB reaches this limit, it stops the operation and returns
the matching values up to the limit, and a key in LastEvaluatedKey to
apply in a subsequent operation to continue the operation.
next_token
class-attribute
instance-attribute
¶
next_token: str | None = None
Set this value to get remaining results, if NextToken was returned in
the statement response.
parameters
class-attribute
instance-attribute
¶
parameters: list[AttributeValue] | None = None
The parameters for the PartiQL statement, if any.
return_consumed_capacity
class-attribute
instance-attribute
¶
return_consumed_capacity: ReturnConsumedCapacity | None = None
Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:
INDEXES- The response includes the aggregateConsumedCapacityfor the operation, together withConsumedCapacityfor each table and secondary index that was accessed.
Note that some operations, such as GetItem and BatchGetItem, do
not access any indexes at all. In these cases, specifying INDEXES
will only return ConsumedCapacity information for table(s).
-
TOTAL- The response includes only the aggregateConsumedCapacityfor the operation. -
NONE- NoConsumedCapacitydetails are included in the response.
return_values_on_condition_check_failure
class-attribute
instance-attribute
¶
return_values_on_condition_check_failure: ReturnValuesOnConditionCheckFailure | None = None
An optional parameter that returns the item attributes for an
ExecuteStatement operation that failed a condition check.
There is no additional cost associated with requesting a return value aside from the small network and processing overhead of receiving a larger response. No read capacity units are consumed.
Output¶
ExecuteStatementOutput
dataclass
¶
Dataclass for ExecuteStatementOutput structure.
Attributes¶
consumed_capacity
class-attribute
instance-attribute
¶
consumed_capacity: ConsumedCapacity | None = None
The capacity units consumed by an operation. The data returned includes
the total provisioned throughput consumed, along with statistics for the
table and any indexes involved in the operation. ConsumedCapacity is
only returned if the request asked for it. For more information, see
Provisioned capacity
mode
in the Amazon DynamoDB Developer Guide.
items
class-attribute
instance-attribute
¶
items: list[dict[str, AttributeValue]] | None = None
If a read operation was used, this property will contain the result of the read operation; a map of attribute names and their values. For the write operations this value will be empty.
last_evaluated_key
class-attribute
instance-attribute
¶
last_evaluated_key: dict[str, AttributeValue] | None = None
The primary key of the item where the operation stopped, inclusive of
the previous result set. Use this value to start a new operation,
excluding this value in the new request. If LastEvaluatedKey is empty,
then the "last page" of results has been processed and there is no
more data to be retrieved. If LastEvaluatedKey is not empty, it does
not necessarily mean that there is more data in the result set. The only
way to know when you have reached the end of the result set is when
LastEvaluatedKey is empty.