Reads rows from the database using key lookups and scans, as a simple key/value style alternative tosessions.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 aFAILED_PRECONDITIONerror.
Reads inside read-write transactions might returnABORTED. If this occurs, the application should restart the transaction from the beginning. SeeTransactionfor more details.
Larger result sets can be yielded in streaming fashion by callingsessions.streamingReadinstead.
The transaction to use. If none is provided, the default is a temporary read-only transaction with strong concurrency.
table
string
Required. The name of the table in the database to be read.
index
string
If non-empty, the name of an index ontable. This index is used instead of the table primary key when interpretingkeySetand sorting result rows. SeekeySetfor further information.
columns[]
string
Required. The columns oftableto be returned for each row matching this request.
Required.keySetidentifies the rows to be yielded.keySetnames the primary keys of the rows intableto be yielded, unlessindexis present. Ifindexis present, thenkeySetinstead names index keys inindex.
If thepartitionTokenfield is empty, rows are yielded in table primary key order (ifindexis empty) or index key order (ifindexis non-empty). If thepartitionTokenfield isn't empty, rows are yielded in an unspecified order.
It isn't an error for thekeySetto name rows that don't exist in the database. sessions.read yields nothing for nonexistent rows.
If this request is resuming a previously interrupted read,resumeTokenshould be copied from the lastPartialResultSetyielded 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.
If present, results are restricted to the specified partition previously created usingsessions.partitionRead. There must be an exact match for the values of fields common to this message and the PartitionReadRequest message used to create this partitionToken.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-18 UTC."],[],[],null,["# Method: projects.instances.databases.sessions.read\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nReads rows from the database using key lookups and scans, as a simple key/value style alternative to [sessions.executeSql](/spanner/docs/reference/rest/v1/projects.instances.databases.sessions/executeSql#google.spanner.v1.Spanner.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.\n\nReads inside read-write transactions might return `ABORTED`. If this occurs, the application should restart the transaction from the beginning. See [Transaction](/spanner/docs/reference/rest/v1/Transaction) for more details.\n\nLarger result sets can be yielded in streaming fashion by calling [sessions.streamingRead](/spanner/docs/reference/rest/v1/projects.instances.databases.sessions/streamingRead#google.spanner.v1.Spanner.StreamingRead) instead.\n\n### HTTP request\n\nChoose a location: \nglobal europe-west8 me-central2 us-central1 us-central2 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4 us-west8 us-east7 \n\n\u003cbr /\u003e\n\nThe URLs use [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Request body\n\nThe request body contains data with the following structure:\n\n### Response body\n\nIf successful, the response body contains an instance of [ResultSet](/spanner/docs/reference/rest/v1/ResultSet).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/spanner.data`\n- `https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp)."]]