# Google Cloud Spanner v1 API - Class ExecuteSqlRequest (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 ExecuteSqlRequest : IMessage<ExecuteSqlRequest>, IEquatable<ExecuteSqlRequest>, IDeepCloneable<ExecuteSqlRequest>, IBufferMessage, IMessage

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

The request for \[ExecuteSql\]\[google.spanner.v1.Spanner.ExecuteSql\] and
\[ExecuteStreamingSql\]\[google.spanner.v1.Spanner.ExecuteStreamingSql\].

## Inheritance

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

## Implements

[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[ExecuteSqlRequest](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[ExecuteSqlRequest](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[ExecuteSqlRequest](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest), [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

### ExecuteSqlRequest()

    public ExecuteSqlRequest()

### ExecuteSqlRequest(ExecuteSqlRequest)

    public ExecuteSqlRequest(ExecuteSqlRequest other)

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

## Properties

### DataBoostEnabled

    public bool DataBoostEnabled { get; set; }

If this is for a partitioned query 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` |   |

### LastStatement

    public bool LastStatement { get; set; }

Optional. If set to `true`, this statement marks the end of the
transaction. After this statement executes, you must commit or abort the
transaction. Attempts to execute any other requests against this
transaction (including reads and queries) are rejected.

For DML statements, setting this option might cause some error reporting to
be deferred until commit time (for example, validation of unique
constraints). Given this, successful execution of a DML statement shouldn't
be assumed until a subsequent `Commit` call completes successfully.

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

### ParamTypes

    public MapField<string, Type> ParamTypes { get; }

It isn't always possible for Cloud Spanner to infer the right SQL type
from a JSON value. For example, values of type `BYTES` and values
of type `STRING` both appear in
\[params\]\[google.spanner.v1.ExecuteSqlRequest.params\] as JSON strings.

In these cases, you can use `param_types` to specify the exact
SQL type for some or all of the SQL statement parameters. See the
definition of \[Type\]\[google.spanner.v1.Type\] for more information
about SQL types.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.MapField-2.htmlhttps://learn.microsoft.com/dotnet/api/system.stringhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.Type` |   |

### Params

    public Struct Params { get; set; }

Parameter names and values that bind to placeholders in the SQL string.

A parameter placeholder consists of the `@` character followed by the
parameter name (for example, `@firstName`). Parameter names must conform
to the naming requirements of identifiers as specified at
<https://cloud.google.com/spanner/docs/lexical#identifiers>.

Parameters can appear anywhere that a literal value is expected. The same
parameter name can be used more than once, for example:

`"WHERE id > @msg_id AND id < @msg_id + 100"`

It's an error to execute a SQL statement with unbound parameters.

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

### PartitionToken

    public ByteString PartitionToken { get; set; }

If present, results are restricted to the specified partition
previously created using `PartitionQuery`. There must be an exact
match for the values of fields common to this message and the
`PartitionQueryRequest` 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` |   |

### QueryMode

    public ExecuteSqlRequest.Types.QueryMode QueryMode { get; set; }

Used to control the amount of debugging information returned in
\[ResultSetStats\]\[google.spanner.v1.ResultSetStats\]. If
\[partition_token\]\[google.spanner.v1.ExecuteSqlRequest.partition_token\] is
set, \[query_mode\]\[google.spanner.v1.ExecuteSqlRequest.query_mode\] can only
be set to
\[QueryMode.NORMAL\]\[google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL\].

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

### QueryOptions

    public ExecuteSqlRequest.Types.QueryOptions QueryOptions { get; set; }

Query optimizer configuration to use for the given query.

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

### 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 SQL statement
execution, `resume_token` should be copied from the last
\[PartialResultSet\]\[google.spanner.v1.PartialResultSet\] yielded before the
interruption. Doing this enables the new SQL statement execution to resume
where the last one 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` |   |

### Seqno

    public long Seqno { get; set; }

A per-transaction sequence number used to identify this request. This field
makes each request idempotent such that if the request is received multiple
times, at most one succeeds.

The sequence number must be monotonically increasing within the
transaction. If a request arrives for the first time with an out-of-order
sequence number, the transaction can be aborted. Replays of previously
handled requests yield the same response as the first execution.

Required for DML statements. Ignored for queries.

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

### Session

    public string Session { get; set; }

Required. The session in which the SQL query 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.ExecuteSqlRequest#Google_Cloud_Spanner_V1_ExecuteSqlRequest_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` |   |

### Sql

    public string Sql { get; set; }

Required. The SQL string.

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

### Transaction

    public TransactionSelector Transaction { get; set; }

The transaction to use.

For queries, if none is provided, the default is a temporary read-only
transaction with strong concurrency.

Standard DML statements require a read-write transaction. To protect
against replays, single-use transactions are not supported. The caller
must either supply an existing transaction ID or begin a new transaction.

Partitioned DML requires an existing Partitioned DML transaction ID.

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