DynamoDBClient.scan
rboto-dynamodb==0.4.0 · Service index · Types
Model summary (excerpt): The Scan operation returns one or more items and item attributes by accessing every item in a table or a secondary index. To have DynamoDB return fewer items, you can provide a FilterExpression operation. If the total size of scanned items exceeds the maximum dataset size limit of 1 MB, the scan completes and results are returned to the user. The LastEvaluatedKey value is also returned and the...
Install and imports
from rboto import DynamoDBClient
from collections.abc import Sequence
from rboto_dynamodb.types import (
AttributeValue,
Condition,
ConditionalOperator,
ReturnConsumedCapacity,
ScanOutput,
Select,
)
Signature
async def scan(
*,
table_name: str,
index_name: str | None = None,
attributes_to_get: Sequence[str] | None = None,
limit: int | None = None,
select: Select | None = None,
scan_filter: dict[str, Condition] | None = None,
conditional_operator: ConditionalOperator | None = None,
exclusive_start_key: dict[str, AttributeValue] | None = None,
return_consumed_capacity: ReturnConsumedCapacity | None = None,
total_segments: int | None = None,
segment: int | None = None,
projection_expression: str | None = None,
filter_expression: str | None = None,
expression_attribute_names: dict[str, str] | None = None,
expression_attribute_values: dict[str, AttributeValue] | None = None,
consistent_read: bool | None = None,
) -> ScanOutput: ...
Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.
Arguments
| Argument | Required | Model notes (excerpt) |
|---|---|---|
table_name |
Yes | The name of the table containing the requested items or if you provide IndexName , the name of the table to which that index belongs. You can also provide the Amazon Resource Name (ARN) of the table in this parameter. |
index_name |
No | The name of a secondary index to scan. This index can be any local secondary index or global secondary index. Note that if you use the IndexName parameter, you must also provide TableName . |
attributes_to_get |
No | This is a legacy parameter. Use ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide . |
limit |
No | 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, and a key in LastEvaluatedKey to apply in a subsequent operation, so that you can pick up where you left off. Also, if the processed dataset size... |
select |
No | The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index. ALL_ATTRIBUTES - Returns all of the item attributes from the specified table or index. If you query a local secondary index, then for each matching item in the index,... |
scan_filter |
No | This is a legacy parameter. Use FilterExpression instead. For more information, see ScanFilter in the Amazon DynamoDB Developer Guide . |
conditional_operator |
No | This is a legacy parameter. Use FilterExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide . |
exclusive_start_key |
No | The primary key of the first item that this operation will evaluate. Use the value that was returned for LastEvaluatedKey in the previous operation. The data type for ExclusiveStartKey must be String, Number or Binary. No set data types are allowed. In a parallel scan, a Scan request that includes ExclusiveStartKey must specify the same segment whose previous Scan returned the corresponding... |
return_consumed_capacity |
No | |
total_segments |
No | For a parallel Scan request, TotalSegments represents the total number of segments into which the Scan operation will be divided. The value of TotalSegments corresponds to the number of application workers that will perform the parallel scan. For example, if you want to use four application threads to scan a table or an index, specify a TotalSegments value of 4. The value for TotalSegments... |
segment |
No | For a parallel Scan request, Segment identifies an individual segment to be scanned by an application worker. Segment IDs are zero-based, so the first segment is always 0. For example, if you want to use four application threads to scan a table or an index, then the first thread specifies a Segment value of 0, the second thread specifies 1, and so on. The value of LastEvaluatedKey returned... |
projection_expression |
No | A string that identifies one or more attributes to retrieve from the specified table or index. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas. If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.... |
filter_expression |
No | A string that contains conditions that DynamoDB applies after the Scan operation, but before the data is returned to you. Items that do not satisfy the FilterExpression criteria are not returned. A FilterExpression is applied after the items have already been read; the process of filtering does not consume any additional read capacity units. For more information, see Filter Expressions in the... |
expression_attribute_names |
No | One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames : To access an attribute whose name conflicts with a DynamoDB reserved word. To create a placeholder for repeating occurrences of an attribute name in an expression. To prevent special characters in an attribute name from being misinterpreted in an... |
expression_attribute_values |
No | One or more values that can be substituted in an expression. Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following: Available | Backordered | Discontinued You would first need to specify ExpressionAttributeValues as follows: {... |
consistent_read |
No | A Boolean value that determines the read consistency model during the scan: If ConsistentRead is false , then the data returned from Scan might not contain the results from other recently completed write operations ( PutItem , UpdateItem , or DeleteItem ). If ConsistentRead is true , then all of the write operations that completed before the Scan began are guaranteed to be contained in the... |
Output
ScanOutput.
Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.
| Field | Type | Presence | References |
|---|---|---|---|
items |
list[dict[str, AttributeValueOutput]] | None |
Always present | AttributeValueOutput |
count |
int |
Always present | — |
scanned_count |
int |
Always present | — |
last_evaluated_key |
dict[str, AttributeValueOutput] | None |
Always present | AttributeValueOutput |
consumed_capacity |
ConsumedCapacityOutput | None |
Always present | ConsumedCapacityOutput |
| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.
Related types
AttributeValue, Condition, ConditionalOperator, ReturnConsumedCapacity, ScanOutput, Select
Follow these links for nested inputs and outputs; recursive types link back to the same type page.
Pagination and streaming
client.paginators.scan(...) accepts the same arguments and returns AsyncIterator[ScanOutput]. Direct calls return one page. Pages preserve the Output representation above.
Input cursors: exclusive_start_key. Page-size argument: limit.
No output stream.
Errors
Import from rboto_dynamodb.exceptions:
InternalServerError, InvalidEndpointError, ProvisionedThroughputExceededError, RequestLimitExceededError, ResourceNotFoundError, ThrottlingError.
Other service failures use the service base error; credential, transport and timeout failures use shared errors.