Classes
BatchCreateSessionsRequest
The request for [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
BatchCreateSessionsResponse
The response for [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
BatchWriteRequest
The request for [BatchWrite][google.spanner.v1.Spanner.BatchWrite].
BatchWriteRequest.Types
Container for nested types declared in the BatchWriteRequest message type.
BatchWriteRequest.Types.MutationGroup
A group of mutations to be committed together. Related mutations should be placed in a group. For example, two mutations inserting rows with the same primary key prefix in both parent and child tables are related.
BatchWriteResponse
The result of applying a batch of mutations.
BeginTransactionRequest
The request for [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction].
ChangeStreamRecord
Spanner Change Streams enable customers to capture and stream out changes to their Spanner databases in real-time. A change stream can be created with option partition_mode='IMMUTABLE_KEY_RANGE' or partition_mode='MUTABLE_KEY_RANGE'.
This message is only used in Change Streams created with the option partition_mode='MUTABLE_KEY_RANGE'. Spanner automatically creates a special Table-Valued Function (TVF) along with each Change Streams. The function provides access to the change stream's records. The function is named READ_<change_stream_name> (where <change_stream_name> is the name of the change stream), and it returns a table with only one column called ChangeRecord.
ChangeStreamRecord.Types
Container for nested types declared in the ChangeStreamRecord message type.
ChangeStreamRecord.Types.DataChangeRecord
A data change record contains a set of changes to a table with the same modification type (insert, update, or delete) committed at the same commit timestamp in one change stream partition for the same transaction. Multiple data change records can be returned for the same transaction across multiple change stream partitions.
ChangeStreamRecord.Types.DataChangeRecord.Types
Container for nested types declared in the DataChangeRecord message type.
ChangeStreamRecord.Types.DataChangeRecord.Types.ColumnMetadata
Metadata for a column.
ChangeStreamRecord.Types.DataChangeRecord.Types.Mod
A mod describes all data changes in a watched table row.
ChangeStreamRecord.Types.DataChangeRecord.Types.ModValue
Returns the value and associated metadata for a particular field of the [Mod][google.spanner.v1.ChangeStreamRecord.DataChangeRecord.Mod].
ChangeStreamRecord.Types.HeartbeatRecord
A heartbeat record is returned as a progress indicator, when there are no data changes or any other partition record types in the change stream partition.
ChangeStreamRecord.Types.PartitionEndRecord
A partition end record serves as a notification that the client should stop reading the partition. No further records are expected to be retrieved on it.
ChangeStreamRecord.Types.PartitionEventRecord
A partition event record describes key range changes for a change stream partition. The changes to a row defined by its primary key can be captured in one change stream partition for a specific time range, and then be captured in a different change stream partition for a different time range. This movement of key ranges across change stream partitions is a reflection of activities, such as Spanner's dynamic splitting and load balancing, etc. Processing this event is needed if users want to guarantee processing of the changes for any key in timestamp order. If time ordered processing of changes for a primary key is not needed, this event can be ignored. To guarantee time ordered processing for each primary key, if the event describes move-ins, the reader of this partition needs to wait until the readers of the source partitions have processed all records with timestamps <= this PartitionEventRecord.commit_timestamp, before advancing beyond this PartitionEventRecord. If the event describes move-outs, the reader can notify the readers of the destination partitions that they can continue processing.
ChangeStreamRecord.Types.PartitionEventRecord.Types
Container for nested types declared in the PartitionEventRecord message type.
ChangeStreamRecord.Types.PartitionEventRecord.Types.MoveInEvent
Describes move-in of the key ranges into the change stream partition identified by [partition_token][google.spanner.v1.ChangeStreamRecord.PartitionEventRecord.partition_token].
To maintain processing the changes for a particular key in timestamp order, the query processing the change stream partition identified by [partition_token][google.spanner.v1.ChangeStreamRecord.PartitionEventRecord.partition_token] should not advance beyond the partition event record commit timestamp until the queries processing the source change stream partitions have processed all change stream records with timestamps <= the partition event record commit timestamp.
ChangeStreamRecord.Types.PartitionEventRecord.Types.MoveOutEvent
Describes move-out of the key ranges out of the change stream partition identified by [partition_token][google.spanner.v1.ChangeStreamRecord.PartitionEventRecord.partition_token].
To maintain processing the changes for a particular key in timestamp order, the query processing the [MoveOutEvent][google.spanner.v1.ChangeStreamRecord.PartitionEventRecord.MoveOutEvent] in the partition identified by [partition_token][google.spanner.v1.ChangeStreamRecord.PartitionEventRecord.partition_token] should inform the queries processing the destination partitions that they can unblock and proceed processing records past the [commit_timestamp][google.spanner.v1.ChangeStreamRecord.PartitionEventRecord.commit_timestamp].
ChangeStreamRecord.Types.PartitionStartRecord
A partition start record serves as a notification that the client should schedule the partitions to be queried. PartitionStartRecord returns information about one or more partitions.
CommitRequest
The request for [Commit][google.spanner.v1.Spanner.Commit].
CommitResponse
The response for [Commit][google.spanner.v1.Spanner.Commit].
CommitResponse.Types
Container for nested types declared in the CommitResponse message type.
CommitResponse.Types.CommitStats
Additional statistics about a commit.
CreateSessionRequest
The request for [CreateSession][google.spanner.v1.Spanner.CreateSession].
DeleteSessionRequest
The request for [DeleteSession][google.spanner.v1.Spanner.DeleteSession].
DirectedReadOptions
The DirectedReadOptions
can be used to indicate which replicas or regions
should be used for non-transactional reads or queries.
DirectedReadOptions
can only be specified for a read-only transaction,
otherwise the API returns an INVALID_ARGUMENT
error.
DirectedReadOptions.Types
Container for nested types declared in the DirectedReadOptions message type.
DirectedReadOptions.Types.ExcludeReplicas
An ExcludeReplicas contains a repeated set of ReplicaSelection that should be excluded from serving requests.
DirectedReadOptions.Types.IncludeReplicas
An IncludeReplicas
contains a repeated set of ReplicaSelection
which
indicates the order in which replicas should be considered.
DirectedReadOptions.Types.ReplicaSelection
The directed read replica selector. Callers must provide one or more of the following fields for replica selection:
location
- The location must be one of the regions within the multi-region configuration of your database.type
- The type of the replica.
Some examples of using replica_selectors are:
location:us-east1
--> The "us-east1" replica(s) of any available type is used to process the request.type:READ_ONLY
--> The "READ_ONLY" type replica(s) in the nearest available location are used to process the request.location:us-east1 type:READ_ONLY
--> The "READ_ONLY" type replica(s) in location "us-east1" is used to process the request.
DirectedReadOptions.Types.ReplicaSelection.Types
Container for nested types declared in the ReplicaSelection message type.
ExecuteBatchDmlRequest
The request for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml].
ExecuteBatchDmlRequest.Types
Container for nested types declared in the ExecuteBatchDmlRequest message type.
ExecuteBatchDmlRequest.Types.Statement
A single DML statement.
ExecuteBatchDmlResponse
The response for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list of [ResultSet][google.spanner.v1.ResultSet] messages, one for each DML statement that has successfully executed, in the same order as the statements in the request. If a statement fails, the status in the response body identifies the cause of the failure.
To check for DML statements that failed, use the following approach:
- Check the status in the response message. The
[google.rpc.Code][google.rpc.Code] enum
value
OK
indicates that all statements were executed successfully. - If the status was not
OK
, check the number of result sets in the response. If the response containsN
[ResultSet][google.spanner.v1.ResultSet] messages, then statementN+1
in the request failed.
Example 1:
- Request: 5 DML statements, all executed successfully.
- Response: 5 [ResultSet][google.spanner.v1.ResultSet] messages, with the
status
OK
.
Example 2:
- Request: 5 DML statements. The third statement has a syntax error.
- Response: 2 [ResultSet][google.spanner.v1.ResultSet] messages, and a syntax
error (
INVALID_ARGUMENT
) status. The number of [ResultSet][google.spanner.v1.ResultSet] messages indicates that the third statement failed, and the fourth and fifth statements were not executed.
ExecuteSqlRequest
The request for [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql].
ExecuteSqlRequest.Types
Container for nested types declared in the ExecuteSqlRequest message type.
ExecuteSqlRequest.Types.QueryOptions
Query optimizer configuration.
GetSessionRequest
The request for [GetSession][google.spanner.v1.Spanner.GetSession].
Interval
Represents the Spanner Interval type.
KeyRange
KeyRange represents a range of rows in a table or index.
A range has a start key and an end key. These keys can be open or closed, indicating if the range includes rows with that key.
Keys are represented by lists, where the ith value in the list corresponds to the ith component of the table or index primary key. Individual values are encoded as described [here][google.spanner.v1.TypeCode].
For example, consider the following table definition:
CREATE TABLE UserEvents (
UserName STRING(MAX),
EventDate STRING(10)
) PRIMARY KEY(UserName, EventDate);
The following keys name rows in this table:
["Bob", "2014-09-23"]
["Alfred", "2015-06-12"]
Since the UserEvents
table's PRIMARY KEY
clause names two
columns, each UserEvents
key has two elements; the first is the
UserName
, and the second is the EventDate
.
Key ranges with multiple components are interpreted
lexicographically by component using the table or index key's declared
sort order. For example, the following range returns all events for
user "Bob"
that occurred in the year 2015:
"start_closed": ["Bob", "2015-01-01"]
"end_closed": ["Bob", "2015-12-31"]
Start and end keys can omit trailing key components. This affects the inclusion and exclusion of rows that exactly match the provided key components: if the key is closed, then rows that exactly match the provided components are included; if the key is open, then rows that exactly match are not included.
For example, the following range includes all events for "Bob"
that
occurred during and after the year 2000:
"start_closed": ["Bob", "2000-01-01"]
"end_closed": ["Bob"]
The next example retrieves all events for "Bob"
:
"start_closed": ["Bob"]
"end_closed": ["Bob"]
To retrieve events before the year 2000:
"start_closed": ["Bob"]
"end_open": ["Bob", "2000-01-01"]
The following range includes all rows in the table:
"start_closed": []
"end_closed": []
This range returns all users whose UserName
begins with any
character from A to C:
"start_closed": ["A"]
"end_open": ["D"]
This range returns all users whose UserName
begins with B:
"start_closed": ["B"]
"end_open": ["C"]
Key ranges honor column sort order. For example, suppose a table is defined as follows:
CREATE TABLE DescendingSortedTable {
Key INT64,
...
) PRIMARY KEY(Key DESC);
The following range retrieves all rows with key values between 1 and 100 inclusive:
"start_closed": ["100"]
"end_closed": ["1"]
Note that 100 is passed as the start, and 1 is passed as the end,
because Key
is a descending column in the schema.
KeySet
KeySet
defines a collection of Cloud Spanner keys and/or key ranges. All
the keys are expected to be in the same table or index. The keys need
not be sorted in any particular way.
If the same key is specified multiple times in the set (for example if two ranges, two keys, or a key and a range overlap), Cloud Spanner behaves as if the key were only specified once.
ListSessionsRequest
The request for [ListSessions][google.spanner.v1.Spanner.ListSessions].
ListSessionsResponse
The response for [ListSessions][google.spanner.v1.Spanner.ListSessions].
MultiplexedSessionPrecommitToken
When a read-write transaction is executed on a multiplexed session, this precommit token is sent back to the client as a part of the [Transaction][google.spanner.v1.Transaction] message in the [BeginTransaction][google.spanner.v1.BeginTransactionRequest] response and also as a part of the [ResultSet][google.spanner.v1.ResultSet] and [PartialResultSet][google.spanner.v1.PartialResultSet] responses.
Mutation
A modification to one or more Cloud Spanner rows. Mutations can be applied to a Cloud Spanner database by sending them in a [Commit][google.spanner.v1.Spanner.Commit] call.
Mutation.Types
Container for nested types declared in the Mutation message type.
Mutation.Types.Delete
Arguments to [delete][google.spanner.v1.Mutation.delete] operations.
Mutation.Types.Write
Arguments to [insert][google.spanner.v1.Mutation.insert], [update][google.spanner.v1.Mutation.update], [insert_or_update][google.spanner.v1.Mutation.insert_or_update], and [replace][google.spanner.v1.Mutation.replace] operations.
PartialResultSet
Partial results from a streaming read or SQL query. Streaming reads and SQL queries better tolerate large result sets, large rows, and large values, but are a little trickier to consume.
Partition
Information returned for each partition returned in a PartitionResponse.
PartitionOptions
Options for a PartitionQueryRequest
and PartitionReadRequest
.
PartitionQueryRequest
The request for [PartitionQuery][google.spanner.v1.Spanner.PartitionQuery]
PartitionReadOrQueryRequest
Class for common properties of PartitionReadRequest and PartitionQueryRequest.
PartitionReadRequest
The request for [PartitionRead][google.spanner.v1.Spanner.PartitionRead]
PartitionResponse
The response for [PartitionQuery][google.spanner.v1.Spanner.PartitionQuery] or [PartitionRead][google.spanner.v1.Spanner.PartitionRead]
PlanNode
Node information for nodes appearing in a [QueryPlan.plan_nodes][google.spanner.v1.QueryPlan.plan_nodes].
PlanNode.Types
Container for nested types declared in the PlanNode message type.
PlanNode.Types.ChildLink
Metadata associated with a parent-child relationship appearing in a [PlanNode][google.spanner.v1.PlanNode].
PlanNode.Types.ShortRepresentation
Condensed representation of a node and its subtree. Only present for
SCALAR
[PlanNode(s)][google.spanner.v1.PlanNode].
PooledSession
A session from a SessionPool, with an associated transaction if requested. Instances must be released back to the pool via ReleaseToPool(bool).
QueryPlan
Contains an ordered list of nodes appearing in the query plan.
ReadOrQueryRequest
Class for common properties of ReadRequest and ExecuteSqlRequest.
ReadRequest
The request for [Read][google.spanner.v1.Spanner.Read] and [StreamingRead][google.spanner.v1.Spanner.StreamingRead].
ReadRequest.Types
Container for nested types declared in the ReadRequest message type.
ReliableStreamReader
Provides streaming access to a Spanner SQL query that automatically retries, handles chunking and recoverable errors.
RequestOptions
Common request options for various APIs.
RequestOptions.Types
Container for nested types declared in the RequestOptions message type.
ResultSet
Results from [Read][google.spanner.v1.Spanner.Read] or [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
ResultSetMetadata
Metadata about a [ResultSet][google.spanner.v1.ResultSet] or [PartialResultSet][google.spanner.v1.PartialResultSet].
ResultSetStats
Additional statistics about a [ResultSet][google.spanner.v1.ResultSet] or [PartialResultSet][google.spanner.v1.PartialResultSet].
RollbackRequest
The request for [Rollback][google.spanner.v1.Spanner.Rollback].
Session
A session in the Cloud Spanner API.
SessionName
Resource name for the Session
resource.
SessionPool
A pool of sessions associated with a SpannerClient. Sessions can be acquired by specifying the desired transaction options, if any. A session/transaction pair is then returned, which should be returned to the pool when it is no longer required. Sessions are kept alive automatically, and retired if they are expired by the server.
SessionPool.SessionPoolSegmentKey
Aspects under which a session pool is segmented.
SessionPool.SessionPoolSegmentStatistics
A snapshot of statistics for a SessionPool.SessionPoolSegmentKey within a SessionPool.
SessionPool.Statistics
A snapshot of statistics for a SessionPool.
SessionPoolOptions
Options for session pools.
Spanner
Cloud Spanner API
The Cloud Spanner API can be used to manage sessions and execute transactions on data stored in Cloud Spanner databases.
Spanner.SpannerBase
Base class for server-side implementations of Spanner
Spanner.SpannerClient
Client for Spanner
SpannerClient
Spanner client wrapper, for convenient use.
SpannerClient.BatchWriteStream
Server streaming methods for BatchWrite(BatchWriteRequest, CallSettings).
SpannerClient.ExecuteStreamingSqlStream
Server streaming methods for ExecuteStreamingSql(ExecuteSqlRequest, CallSettings).
SpannerClient.StreamingReadStream
Server streaming methods for StreamingRead(ReadRequest, CallSettings).
SpannerClientBuilder
Builder class for SpannerClient to provide simple configuration of credentials, endpoint etc.
SpannerClientImpl
Spanner client wrapper implementation, for convenient use.
SpannerSettings
Settings for SpannerClient instances.
StreamClosedEventArgs
Event argument type for StreamClosed.
StructType
StructType
defines the fields of a
[STRUCT][google.spanner.v1.TypeCode.STRUCT] type.
StructType.Types
Container for nested types declared in the StructType message type.
StructType.Types.Field
Message representing a single field of a struct.
Transaction
A transaction.
TransactionOptions
Options to use for transactions.
TransactionOptions.Types
Container for nested types declared in the TransactionOptions message type.
TransactionOptions.Types.PartitionedDml
Message type to initiate a Partitioned DML transaction.
TransactionOptions.Types.ReadOnly
Message type to initiate a read-only transaction.
TransactionOptions.Types.ReadWrite
Message type to initiate a read-write transaction. Currently this transaction type has no options.
TransactionOptions.Types.ReadWrite.Types
Container for nested types declared in the ReadWrite message type.
TransactionSelector
This message is used to select the transaction in which a [Read][google.spanner.v1.Spanner.Read] or [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] call runs.
See [TransactionOptions][google.spanner.v1.TransactionOptions] for more information about transactions.
Type
Type
indicates the type of a Cloud Spanner value, as might be stored in a
table cell or returned from an SQL query.
TypeCodeExtensions
Extension methods and factory methods for type codes.
Structs
PgNumeric
Representation of PostgreSQL numeric type which has max precision of 147455 and a max scale of 16383.
SpannerDate
The SpannerDate type represents a logical calendar date, independent of time zone. Represents dates with values ranging from January 1, 0001 A.D through December 31, 9999 A.D. in the Gregorian calendar.
SpannerNumeric
Representation of the Spanner NUMERIC type, which has 38 digits of precision, and a fixed scale of 9 decimal places to the right of the decimal point
Enums
ChangeStreamRecord.RecordOneofCase
Enum of possible cases for the "record" oneof.
ChangeStreamRecord.Types.DataChangeRecord.Types.ModType
Mod type describes the type of change Spanner applied to the data. For example, if the client submits an INSERT_OR_UPDATE request, Spanner will perform an insert if there is no existing row and return ModType INSERT. Alternatively, if there is an existing row, Spanner will perform an update and return ModType UPDATE.
ChangeStreamRecord.Types.DataChangeRecord.Types.ValueCaptureType
Value capture type describes which values are recorded in the data change record.
CommitRequest.TransactionOneofCase
Enum of possible cases for the "transaction" oneof.
CommitResponse.MultiplexedSessionRetryOneofCase
Enum of possible cases for the "MultiplexedSessionRetry" oneof.
DirectedReadOptions.ReplicasOneofCase
Enum of possible cases for the "replicas" oneof.
DirectedReadOptions.Types.ReplicaSelection.Types.Type
Indicates the type of replica.
ExecuteSqlRequest.Types.QueryMode
Mode in which the statement must be processed.
KeyRange.EndKeyTypeOneofCase
Enum of possible cases for the "end_key_type" oneof.
KeyRange.StartKeyTypeOneofCase
Enum of possible cases for the "start_key_type" oneof.
LossOfPrecisionHandling
Handling for a conversion that would lose precision.
Mutation.OperationOneofCase
Enum of possible cases for the "operation" oneof.
PlanNode.Types.Kind
The kind of [PlanNode][google.spanner.v1.PlanNode]. Distinguishes between the two different kinds of nodes that can appear in a query plan.
ReadRequest.Types.LockHint
A lock hint mechanism for reads done within a transaction.
ReadRequest.Types.OrderBy
An option to control the order in which rows are returned from a read.
RequestOptions.Types.Priority
The relative priority for requests. Note that priority isn't applicable for [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction].
The priority acts as a hint to the Cloud Spanner scheduler and doesn't guarantee priority or order of execution. For example:
- Some parts of a write operation always execute at
PRIORITY_HIGH
, regardless of the specified priority. This can cause you to see an increase in high priority workload even when executing a low priority request. This can also potentially cause a priority inversion where a lower priority request is fulfilled ahead of a higher priority request. - If a transaction contains multiple operations with different priorities, Cloud Spanner doesn't guarantee to process the higher priority operations first. There might be other constraints to satisfy, such as the order of operations.
ResourcesExhaustedBehavior
Specifies the behavior when MaximumActiveSessions is reached.
ResultSetStats.RowCountOneofCase
Enum of possible cases for the "row_count" oneof.
SessionName.ResourceNameType
The possible contents of SessionName.
TransactionOptions.ModeOneofCase
Enum of possible cases for the "mode" oneof.
TransactionOptions.Types.IsolationLevel
IsolationLevel
is used when setting isolation_level
for a transaction.
TransactionOptions.Types.ReadOnly.TimestampBoundOneofCase
Enum of possible cases for the "timestamp_bound" oneof.
TransactionOptions.Types.ReadWrite.Types.ReadLockMode
ReadLockMode
is used to set the read lock mode for read-write
transactions.
TransactionSelector.SelectorOneofCase
Enum of possible cases for the "selector" oneof.
TypeAnnotationCode
TypeAnnotationCode
is used as a part of [Type][google.spanner.v1.Type] to
disambiguate SQL types that should be used for a given Cloud Spanner value.
Disambiguation is needed because the same Cloud Spanner type can be mapped to
different SQL types depending on SQL dialect. TypeAnnotationCode doesn't
affect the way value is serialized.
TypeCode
TypeCode
is used as part of [Type][google.spanner.v1.Type] to
indicate the type of a Cloud Spanner value.
Each legal value of a type can be encoded to or decoded from a JSON
value, using the encodings described below. All Cloud Spanner values can
be null
, regardless of type; null
s are always encoded as a JSON
null
.