Creates a set of partition tokens that can be used to execute a read operation in parallel. Each of the returned partition tokens can be used by Read to specify a subset of the read result to read. The same session and read-only transaction must be used by the PartitionReadRequest
used to create the partition tokens and the ReadRequests
that use the partition tokens. There are no ordering guarantees on rows returned among the returned partition tokens, or even within each individual Read
call issued with a partition_token
. Partition tokens become invalid when the session used to create them is deleted, is idle for too long, begins a new transaction, or becomes too old. When any of these happen, it isn't possible to resume the read, and the whole operation must be restarted from the beginning.
For more information about retries and long-running operations, see Understand connectors.
Arguments
Parameters | |
---|---|
session |
Required. The session used to create the partitions. |
body |
Required. |
Raised exceptions
Exceptions | |
---|---|
ConnectionError | In case of a network problem (such as DNS failure or refused connection). |
HttpError | If the response status is >= 400 (excluding 429 and 503). |
TimeoutError | If a long-running operation takes longer to finish than the specified timeout limit. |
TypeError | If an operation or function receives an argument of the wrong type. |
ValueError | If an operation or function receives an argument of the right type but an inappropriate value. For example, a negative timeout. |
Response
If successful, the response contains an instance of PartitionResponse
.
Subworkflow snippet
Some fields might be optional or required. To identify required fields, refer to the API documentation.
YAML
- partitionRead: call: googleapis.spanner.v1.projects.instances.databases.sessions.partitionRead args: session: ... body: columns: ... index: ... keySet: all: ... keys: ... ranges: ... partitionOptions: maxPartitions: ... partitionSizeBytes: ... table: ... transaction: begin: excludeTxnFromChangeStreams: ... isolationLevel: ... partitionedDml: ... readOnly: exactStaleness: ... maxStaleness: ... minReadTimestamp: ... readTimestamp: ... returnReadTimestamp: ... strong: ... readWrite: multiplexedSessionPreviousTransactionId: ... readLockMode: ... id: ... singleUse: ... result: partitionReadResult
JSON
[ { "partitionRead": { "call": "googleapis.spanner.v1.projects.instances.databases.sessions.partitionRead", "args": { "session": "...", "body": { "columns": "...", "index": "...", "keySet": { "all": "...", "keys": "...", "ranges": "..." }, "partitionOptions": { "maxPartitions": "...", "partitionSizeBytes": "..." }, "table": "...", "transaction": { "begin": { "excludeTxnFromChangeStreams": "...", "isolationLevel": "...", "partitionedDml": "...", "readOnly": { "exactStaleness": "...", "maxStaleness": "...", "minReadTimestamp": "...", "readTimestamp": "...", "returnReadTimestamp": "...", "strong": "..." }, "readWrite": { "multiplexedSessionPreviousTransactionId": "...", "readLockMode": "..." } }, "id": "...", "singleUse": "..." } } }, "result": "partitionReadResult" } } ]