# Google Cloud Spanner v1 API - Class ReadRequest (5.13.0-beta07)

5.13.0-beta07 5.13.0-beta06 5.12.0 (latest) 5.11.0 5.10.0 5.9.0 5.8.0 5.7.0 5.6.0 5.5.0 5.4.0 5.3.0 5.2.0 5.1.0 5.0.0 4.6.0 4.5.0 4.4.0 4.3.0 4.2.0 4.1.0 4.0.0 3.15.1 3.14.0 3.13.0 3.12.0 3.11.0 3.10.0 3.9.0 3.8.0 3.7.0 3.6.0 3.5.0

    public sealed class ReadRequest : IMessage<ReadRequest>, IEquatable<ReadRequest>, IDeepCloneable<ReadRequest>, IBufferMessage, IMessage

Reference documentation and code samples for the Google Cloud Spanner v1 API class ReadRequest.

The request for \[Read\]\[google.spanner.v1.Spanner.Read\] and
\[StreamingRead\]\[google.spanner.v1.Spanner.StreamingRead\].

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> ReadRequest

## Implements

[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[ReadRequest](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequest), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[ReadRequest](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequest), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[ReadRequest](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequest), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html)

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Spanner.V1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1)

## Assembly

Google.Cloud.Spanner.V1.dll

## Constructors

### ReadRequest()

    public ReadRequest()

### ReadRequest(ReadRequest)

    public ReadRequest(ReadRequest other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequest` |

## Properties

### Columns

    public RepeatedField<string> Columns { get; }

Required. The columns of \[table\]\[google.spanner.v1.ReadRequest.table\] to be
returned for each row matching this request.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://learn.microsoft.com/dotnet/api/system.string` |   |

### DataBoostEnabled

    public bool DataBoostEnabled { get; set; }

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.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### DirectedReadOptions

    public DirectedReadOptions DirectedReadOptions { get; set; }

Directed read options for this request.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.DirectedReadOptions` |   |

### Index

    public string Index { get; set; }

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

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### KeySet

    public KeySet KeySet { get; set; }

Required. `key_set` identifies the rows to be yielded. `key_set` names the
primary keys of the rows in \[table\]\[google.spanner.v1.ReadRequest.table\] to
be yielded, unless \[index\]\[google.spanner.v1.ReadRequest.index\] is present.
If \[index\]\[google.spanner.v1.ReadRequest.index\] is present, then
\[key_set\]\[google.spanner.v1.ReadRequest.key_set\] instead names index keys
in \[index\]\[google.spanner.v1.ReadRequest.index\].

If the \[partition_token\]\[google.spanner.v1.ReadRequest.partition_token\]
field is empty, rows are yielded in table primary key order (if
\[index\]\[google.spanner.v1.ReadRequest.index\] is empty) or index key order
(if \[index\]\[google.spanner.v1.ReadRequest.index\] is non-empty). If the
\[partition_token\]\[google.spanner.v1.ReadRequest.partition_token\] field
isn't empty, rows are yielded in an unspecified order.

It isn't an error for the `key_set` to name rows that don't
exist in the database. Read yields nothing for nonexistent rows.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.KeySet` |   |

### Limit

    public long Limit { get; set; }

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.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int64` |   |

### LockHint

    public ReadRequest.Types.LockHint LockHint { get; set; }

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

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequesthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequest.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequest.Types.LockHint` |   |

### OrderBy

    public ReadRequest.Types.OrderBy OrderBy { get; set; }

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).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequesthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequest.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequest.Types.OrderBy` |   |

### PartitionToken

    public ByteString PartitionToken { get; set; }

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.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ByteString.html` |   |

### RequestOptions

    public RequestOptions RequestOptions { get; set; }

Common options for this request.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.RequestOptions` |   |

### ResumeToken

    public ByteString ResumeToken { get; set; }

If this request is resuming a previously interrupted read,
`resume_token` should be copied from the last
\[PartialResultSet\]\[google.spanner.v1.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.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ByteString.html` |   |

### RoutingHint

    public RoutingHint RoutingHint { get; set; }

Optional. Makes the Spanner requests location-aware if present.

It gives the server hints that can be used to route the request
to an appropriate server, potentially significantly decreasing latency and
improving throughput. To achieve improved performance, most fields must be
filled in with accurate values.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.RoutingHint` |   |

### Session

    public string Session { get; set; }

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

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### SessionAsSessionName

    public SessionName SessionAsSessionName { get; set; }

[SessionName](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.SessionName)-typed view over the [Session](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequest#Google_Cloud_Spanner_V1_ReadRequest_Session) resource name property.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.SessionName` |   |

### Table

    public string Table { get; set; }

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

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### Transaction

    public TransactionSelector Transaction { get; set; }

The transaction to use. If none is provided, the default is a
temporary read-only transaction with strong concurrency.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.TransactionSelector` |   |