v1

latestOpenAPI 3.0.0Creative Commons Attribution 3.02026-07-1350180291.1 KB
projects

Reads rows from the database using key lookups and scans, as a simple key/value style alternative to ExecuteSql. This method can't be used to return a result set larger than 10 MiB; if the read matches more data than that, the read fails with a FAILED_PRECONDITION error. Reads inside read-write transactions might return ABORTED. If this occurs, the application should restart the transaction from the beginning. See Transaction for more details. Larger result sets can be yielded in streaming fashion by calling StreamingRead instead.

post/v1/{+session}:read

Path parameters

sessionstring required

Required. The session in which the read should be performed.

Request body

tablestring

Required. The name of the table in the database to be read.

indexstring

If non-empty, the name of an index on table. This index is used instead of the table primary key when interpreting key_set and sorting result rows. See key_set for further information.

columnsstring[]

Required. The columns of table to be returned for each row matching this request.

limitstring int64

If greater than zero, only the first limit rows are yielded. If limit is zero, the default is no limit. A limit can't be specified if partition_token is set.

resumeTokenstring byte

If this request is resuming a previously interrupted read, resume_token should be copied from the last PartialResultSet yielded before the interruption. Doing this enables the new read to resume where the last read left off. The rest of the request parameters must exactly match the request that yielded this token.

partitionTokenstring byte

If present, results are restricted to the specified partition previously created using PartitionRead. There must be an exact match for the values of fields common to this message and the PartitionReadRequest message used to create this partition_token.

dataBoostEnabledboolean

If this is for a partitioned read and this field is set to true, the request is executed with Spanner Data Boost independent compute resources. If the field is set to true but the request doesn't set partition_token, the API returns an INVALID_ARGUMENT error.

orderBy'ORDER_BY_UNSPECIFIED' | 'ORDER_BY_PRIMARY_KEY' | 'ORDER_BY_NO_ORDER'

Optional. Order for the returned rows. By default, Spanner returns result rows in primary key order except for PartitionRead requests. For applications that don't require rows to be returned in primary key (ORDER_BY_PRIMARY_KEY) order, setting ORDER_BY_NO_ORDER option allows Spanner to optimize row retrieval, resulting in lower latencies in certain cases (for example, bulk point lookups).

lockHint'LOCK_HINT_UNSPECIFIED' | 'LOCK_HINT_SHARED' | 'LOCK_HINT_EXCLUSIVE'

Optional. Lock Hint for the request, it can only be used with read-write transactions.

Response

Successful response