Cloud Spanner is a managed, mission-critical, globally consistent and scalable relational database service.
Returns the schema of a Cloud Spanner database as a list of formatted DDL statements. This method does not show pending schema updates, those may be queried using the Operations API.
Name | Data Type | Description |
---|---|---|
database
|
string |
Required. The database whose schema we wish to get. |
Name | Data Type | Description | |||||||
---|---|---|---|---|---|---|---|---|---|
|
GetDatabaseDdlResponse | ||||||||
Properties
|
Updates the schema of a Cloud Spanner database by
creating/altering/dropping tables, columns, indexes, etc. The returned
long-running operation will have a name of
the format <database_name>/operations/<operation_id>
and can be used to
track execution of the schema change(s). The
metadata field type is
UpdateDatabaseDdlMetadata. The operation has no response.
Name | Data Type | Description |
---|---|---|
database
|
string |
Required. The database to update. |
Name | Data Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
UpdateDatabaseDdlRequest | |||||||||||
Properties
|
Name | Data Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Operation | ||||||||||||||||||||||||||||||||||||
Properties
|
Creates multiple new sessions.
This API can be used to initialize a session cache on the clients. See https://goo.gl/TgSFN2 for best practices on session cache management.
Name | Data Type | Description |
---|---|---|
database
|
string |
Required. The database in which the new sessions are created. |
Name | Data Type | Description | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
BatchCreateSessionsRequest | ||||||||||||||||||||||||||||||
Properties
|
Name | Data Type | Description | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
BatchCreateSessionsResponse | |||||||||||||||||||||||||||
Properties
|
Lists all sessions in a given database.
Name | Data Type | Description |
---|---|---|
database
|
string |
Required. The database in which to list sessions. |
Name | Data Type | Description |
---|---|---|
filter
|
string |
An expression for filtering the results of the request. Filter rules are case insensitive. The fields eligible for filtering are:
Some examples of using filters are:
|
pageSize
|
integer |
Number of sessions to be returned in the response. If 0 or less, defaults to the server's maximum allowed page size. |
pageToken
|
string |
If non-empty, |
Name | Data Type | Description | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
ListSessionsResponse | ||||||||||||||||||||||||||||||
Properties
|
Creates a new session. A session can be used to perform transactions that read and/or modify data in a Cloud Spanner database. Sessions are meant to be reused for many consecutive transactions.
Sessions can only execute one transaction at a time. To execute multiple concurrent read-write/write-only transactions, create multiple sessions. Note that standalone reads and queries use a transaction internally, and count toward the one transaction limit.
Active sessions use additional server resources, so it is a good idea to
delete idle and unneeded sessions.
Aside from explicit deletes, Cloud Spanner can delete sessions for which no
operations are sent for more than an hour. If a session is deleted,
requests to it return NOT_FOUND
.
Idle sessions can be kept alive by sending a trivial SQL query
periodically, e.g., "SELECT 1"
.
Name | Data Type | Description |
---|---|---|
database
|
string |
Required. The database in which the new session is created. |
Name | Data Type | Description | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
CreateSessionRequest | |||||||||||||||||||||||||||
Properties
|
Name | Data Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Session | |||||||||||||||||
Properties
|
Drops (aka deletes) a Cloud Spanner database.
Name | Data Type | Description |
---|---|---|
database
|
string |
Required. The database to be dropped. |
Name | Data Type | Description | ||||
---|---|---|---|---|---|---|
|
Empty | |||||
|
Starts asynchronous cancellation on a long-running operation. The server
makes a best effort to cancel the operation, but success is not
guaranteed. If the server doesn't support this method, it returns
google.rpc.Code.UNIMPLEMENTED
. Clients can use
Operations.GetOperation or
other methods to check whether the cancellation succeeded or whether the
operation completed despite cancellation. On successful cancellation,
the operation is not deleted; instead, it becomes an operation with
an Operation.error value with a google.rpc.Status.code of 1,
corresponding to Code.CANCELLED
.
Name | Data Type | Description |
---|---|---|
name
|
string |
The name of the operation resource to be cancelled. |
Name | Data Type | Description | ||||
---|---|---|---|---|---|---|
|
Empty | |||||
|
Deletes a long-running operation. This method indicates that the client is
no longer interested in the operation result. It does not cancel the
operation. If the server doesn't support this method, it returns
google.rpc.Code.UNIMPLEMENTED
.
Name | Data Type | Description |
---|---|---|
name
|
string |
The name of the operation resource to be deleted. |
Name | Data Type | Description | ||||
---|---|---|---|---|---|---|
|
Empty | |||||
|
Gets information about a particular instance configuration.
Name | Data Type | Description |
---|---|---|
name
|
string |
Required. The name of the requested instance configuration. Values are of
the form |
Name | Data Type | Description |
---|---|---|
fieldMask
|
string |
If field_mask is present, specifies the subset of Instance fields that should be returned. If absent, all Instance fields are returned. |
Name | Data Type | Description | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
InstanceConfig | ||||||||||||||||||||||||||||||
Properties
|
Updates an instance, and begins allocating or releasing resources
as requested. The returned long-running
operation can be used to track the
progress of updating the instance. If the named instance does not
exist, returns NOT_FOUND
.
Immediately upon completion of this request:
Until completion of the returned operation:
CANCELLED
status.Upon completion of the returned operation:
The returned long-running operation will
have a name of the format <instance_name>/operations/<operation_id>
and
can be used to track the instance modification. The
metadata field type is
UpdateInstanceMetadata.
The response field type is
Instance, if successful.
Authorization requires spanner.instances.update
permission on
resource name.
Name | Data Type | Description |
---|---|---|
name
|
string |
Required. A unique identifier for the instance, which cannot be changed
after the instance is created. Values are of the form
|
Name | Data Type | Description | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
UpdateInstanceRequest | |||||||||||||||||||||||||||||||||||||||
Properties
|
Name | Data Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Operation | ||||||||||||||||||||||||||||||||||||
Properties
|
Lists Cloud Spanner databases.
Name | Data Type | Description |
---|---|---|
parent
|
string |
Required. The instance whose databases should be listed.
Values are of the form |
Name | Data Type | Description |
---|---|---|
pageSize
|
integer |
Number of databases to be returned in the response. If 0 or less, defaults to the server's maximum allowed page size. |
pageToken
|
string |
If non-empty, |
Name | Data Type | Description | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
ListDatabasesResponse | ||||||||||||||||||||||||
Properties
|
Creates a new Cloud Spanner database and starts to prepare it for serving.
The returned long-running operation will
have a name of the format <database_name>/operations/<operation_id>
and
can be used to track preparation of the database. The
metadata field type is
CreateDatabaseMetadata. The
response field type is
Database, if successful.
Name | Data Type | Description |
---|---|---|
parent
|
string |
Required. The name of the instance that will serve the new database.
Values are of the form |
Name | Data Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
CreateDatabaseRequest | |||||||||||
Properties
|
Name | Data Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Operation | ||||||||||||||||||||||||||||||||||||
Properties
|
Lists the supported instance configurations for a given project.
Name | Data Type | Description |
---|---|---|
parent
|
string |
Required. The name of the project for which a list of supported instance
configurations is requested. Values are of the form
|
Name | Data Type | Description |
---|---|---|
pageSize
|
integer |
Number of instance configurations to be returned in the response. If 0 or less, defaults to the server's maximum allowed page size. |
pageToken
|
string |
If non-empty, |
Name | Data Type | Description | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
ListInstanceConfigsResponse | |||||||||||||||||||||||||||
Properties
|
Lists all instances in the given project.
Name | Data Type | Description |
---|---|---|
parent
|
string |
Required. The name of the project for which a list of instances is
requested. Values are of the form |
Name | Data Type | Description |
---|---|---|
filter
|
string |
An expression for filtering the results of the request. Filter rules are case insensitive. The fields eligible for filtering are:
Some examples of using filters are:
|
pageSize
|
integer |
Number of instances to be returned in the response. If 0 or less, defaults to the server's maximum allowed page size. |
pageToken
|
string |
If non-empty, |
Name | Data Type | Description | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
ListInstancesResponse | |||||||||||||||||||||||||||||||||||||||
Properties
|
Creates an instance and begins preparing it to begin serving. The
returned long-running operation
can be used to track the progress of preparing the new
instance. The instance name is assigned by the caller. If the
named instance already exists, CreateInstance
returns
ALREADY_EXISTS
.
Immediately upon completion of this request:
CREATING
.Until completion of the returned operation:
Upon completion of the returned operation:
READY
.The returned long-running operation will
have a name of the format <instance_name>/operations/<operation_id>
and
can be used to track creation of the instance. The
metadata field type is
CreateInstanceMetadata.
The response field type is
Instance, if successful.
Name | Data Type | Description |
---|---|---|
parent
|
string |
Required. The name of the project in which to create the instance. Values
are of the form |
Name | Data Type | Description | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
CreateInstanceRequest | |||||||||||||||||||||||||||||||||||||||
Properties
|
Name | Data Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Operation | ||||||||||||||||||||||||||||||||||||
Properties
|
Gets the access control policy for a database resource. Returns an empty policy if a database exists but does not have a policy set.
Authorization requires spanner.databases.getIamPolicy
permission on
resource.
Name | Data Type | Description |
---|---|---|
resource
|
string |
REQUIRED: The Cloud Spanner resource for which the policy is being retrieved. The format is |
Name | Data Type | Description | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
GetIamPolicyRequest | ||||||||||||||||||
Properties
|
Name | Data Type | Description | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Policy | ||||||||||||||||||||||||||||||
Properties
|
Sets the access control policy on a database resource. Replaces any existing policy.
Authorization requires spanner.databases.setIamPolicy
permission on resource.
Name | Data Type | Description |
---|---|---|
resource
|
string |
REQUIRED: The Cloud Spanner resource for which the policy is being set. The format is |
Name | Data Type | Description | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
SetIamPolicyRequest | ||||||||||||||||||||||||
Properties
|
Name | Data Type | Description | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Policy | ||||||||||||||||||||||||||||||
Properties
|
Returns permissions that the caller has on the specified database resource.
Attempting this RPC on a non-existent Cloud Spanner database will
result in a NOT_FOUND error if the user has
spanner.databases.list
permission on the containing Cloud
Spanner instance. Otherwise returns an empty set of permissions.
Name | Data Type | Description |
---|---|---|
resource
|
string |
REQUIRED: The Cloud Spanner resource for which permissions are being tested. The format is |
Name | Data Type | Description | |||||||
---|---|---|---|---|---|---|---|---|---|
|
TestIamPermissionsRequest | ||||||||
Properties
|
Name | Data Type | Description | |||||||
---|---|---|---|---|---|---|---|---|---|
|
TestIamPermissionsResponse | ||||||||
Properties
|
Begins a new transaction. This step can often be skipped: Read, ExecuteSql and Commit can begin a new transaction as a side-effect.
Name | Data Type | Description |
---|---|---|
session
|
string |
Required. The session in which the transaction runs. |
Name | Data Type | Description | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
BeginTransactionRequest | ||||||||||||||||||||||||
Properties
|
Name | Data Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Transaction | |||||||||||
Properties
|
Commits a transaction. The request includes the mutations to be applied to rows in the database.
Commit
might return an ABORTED
error. This can occur at any time;
commonly, the cause is conflicts with concurrent
transactions. However, it can also happen for a variety of other
reasons. If Commit
returns ABORTED
, the caller should re-attempt
the transaction from the beginning, re-using the same session.
Name | Data Type | Description |
---|---|---|
session
|
string |
Required. The session in which the transaction to be committed is running. |
Name | Data Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
CommitRequest | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
Name | Data Type | Description | |||||||
---|---|---|---|---|---|---|---|---|---|
|
CommitResponse | ||||||||
Properties
|
Executes a batch of SQL DML statements. This method allows many statements to be run with lower latency than submitting them sequentially with ExecuteSql.
Statements are executed in sequential order. A request can succeed even if a statement fails. The ExecuteBatchDmlResponse.status field in the response provides information about the statement that failed. Clients must inspect this field to determine whether an error occurred.
Execution stops after the first failed statement; the remaining statements are not executed.
Name | Data Type | Description |
---|---|---|
session
|
string |
Required. The session in which the DML statements should be performed. |
Name | Data Type | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
ExecuteBatchDmlRequest | ||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
Name | Data Type | Description | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
ExecuteBatchDmlResponse | |||||||||||||||||||||||||||||||||||||||||||
Properties
|
Executes an SQL statement, returning all results in a single reply. This
method cannot be used to return a result set larger than 10 MiB;
if the query yields more data than that, the query fails with
a FAILED_PRECONDITION
error.
Operations 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 fetched in streaming fashion by calling ExecuteStreamingSql instead.
Name | Data Type | Description |
---|---|---|
session
|
string |
Required. The session in which the SQL query should be performed. |
Name | Data Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
ExecuteSqlRequest | |||||||||||||||||||||||||||||||||||||||||||||
Properties
|
Name | Data Type | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
ResultSet | ||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
Like ExecuteSql, except returns the result set as a stream. Unlike ExecuteSql, there is no limit on the size of the returned result set. However, no individual row in the result set can exceed 100 MiB, and no column value can exceed 10 MiB.
Name | Data Type | Description |
---|---|---|
session
|
string |
Required. The session in which the SQL query should be performed. |
Name | Data Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
ExecuteSqlRequest | |||||||||||||||||||||||||||||||||||||||||||||
Properties
|
Name | Data Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
PartialResultSet | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
Creates a set of partition tokens that can be used to execute a query operation in parallel. Each of the returned partition tokens can be used by ExecuteStreamingSql to specify a subset of the query result to read. The same session and read-only transaction must be used by the PartitionQueryRequest used to create the partition tokens and the ExecuteSqlRequests that use the partition tokens.
Partition tokens become invalid when the session used to create them is deleted, is idle for too long, begins a new transaction, or becomes too old. When any of these happen, it is not possible to resume the query, and the whole operation must be restarted from the beginning.
Name | Data Type | Description |
---|---|---|
session
|
string |
Required. The session used to create the partitions. |
Name | Data Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
PartitionQueryRequest | |||||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
Name | Data Type | Description | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
PartitionResponse | ||||||||||||||||||||||||||||||||||
Properties
|
Creates a set of partition tokens that can be used to execute a read operation in parallel. Each of the returned partition tokens can be used by StreamingRead to specify a subset of the read result to read. The same session and read-only transaction must be used by the PartitionReadRequest used to create the partition tokens and the ReadRequests that use the partition tokens. There are no ordering guarantees on rows returned among the returned partition tokens, or even within each individual StreamingRead call issued with a partition_token.
Partition tokens become invalid when the session used to create them is deleted, is idle for too long, begins a new transaction, or becomes too old. When any of these happen, it is not possible to resume the read, and the whole operation must be restarted from the beginning.
Name | Data Type | Description |
---|---|---|
session
|
string |
Required. The session used to create the partitions. |
Name | Data Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
PartitionReadRequest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
Name | Data Type | Description | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
PartitionResponse | ||||||||||||||||||||||||||||||||||
Properties
|
Reads rows from the database using key lookups and scans, as a
simple key/value style alternative to
ExecuteSql. This method cannot 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.
Name | Data Type | Description |
---|---|---|
session
|
string |
Required. The session in which the read should be performed. |
Name | Data Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
ReadRequest | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
Name | Data Type | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
ResultSet | ||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
Rolls back a transaction, releasing any locks it holds. It is a good idea to call this for any transaction that includes one or more Read or ExecuteSql requests and ultimately decides not to commit.
Rollback
returns OK
if it successfully aborts the transaction, the
transaction was already aborted, or the transaction is not
found. Rollback
never returns ABORTED
.
Name | Data Type | Description |
---|---|---|
session
|
string |
Required. The session in which the transaction to roll back is running. |
Name | Data Type | Description | |||||||
---|---|---|---|---|---|---|---|---|---|
|
RollbackRequest | ||||||||
Properties
|
Name | Data Type | Description | ||||
---|---|---|---|---|---|---|
|
Empty | |||||
|
Like Read, except returns the result set as a stream. Unlike Read, there is no limit on the size of the returned result set. However, no individual row in the result set can exceed 100 MiB, and no column value can exceed 10 MiB.
Name | Data Type | Description |
---|---|---|
session
|
string |
Required. The session in which the read should be performed. |
Name | Data Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
ReadRequest | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
Name | Data Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
PartialResultSet | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
The request for BatchCreateSessions.
Name | Data Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sessionCount
|
integer |
Required. The number of sessions to be created in this batch call. The API may return fewer than the requested number of sessions. If a specific number of sessions are desired, the client can make additional calls to BatchCreateSessions (adjusting session_count as necessary). |
||||||||||||||||
sessionTemplate
|
Session |
Parameters to be applied to each created session. |
||||||||||||||||
Properties
|
The response for BatchCreateSessions.
Name | Data Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
session
|
array [Session] |
The freshly created sessions. |
||||||||||||||||
Properties
|
The request for BeginTransaction.
Name | Data Type | Description | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options
|
TransactionOptions |
Required. Options for the new transaction. |
|||||||||||||
Properties
|
Associates members
with a role
.
Name | Data Type | Description |
---|---|---|
condition
|
Expr |
The condition that is associated with this binding. NOTE: An unsatisfied condition will not allow user access via current binding. Different bindings, including their conditions, are examined independently. |
members
|
array [] |
Specifies the identities requesting access for a Cloud Platform resource.
|
role
|
string |
Role that is assigned to |
The request for Commit.
Name | Data Type | Description | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mutations
|
array [Mutation] |
The mutations to be executed when this transaction commits. All mutations are applied atomically, in the order they appear in this list. |
|||||||||||||||||||
Properties
|
|||||||||||||||||||||
singleUseTransaction
|
TransactionOptions |
Execute mutations in a temporary transaction. Note that unlike
commit of a previously-started transaction, commit with a
temporary transaction is non-idempotent. That is, if the
|
|||||||||||||||||||
Properties
|
|||||||||||||||||||||
transactionId
|
byte |
Commit a previously-started transaction. |
The response for Commit.
Name | Data Type | Description |
---|---|---|
commitTimestamp
|
string |
The Cloud Spanner timestamp at which the transaction committed. |
The request for CreateDatabase.
Name | Data Type | Description |
---|---|---|
createStatement
|
string |
Required. A |
extraStatements
|
array [string] |
An optional list of DDL statements to run inside the newly created database. Statements can create tables, indexes, etc. These statements execute atomically with the creation of the database: if there is an error in any statement, the database is not created. |
The request for CreateInstance.
Name | Data Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
instance
|
Instance |
Required. The instance to create. The name may be omitted, but if
specified must be |
|||||||||||||||||||||||||
Properties
|
|||||||||||||||||||||||||||
instanceId
|
string |
Required. The ID of the instance to create. Valid identifiers are of the
form |
The request for CreateSession.
Name | Data Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
session
|
Session |
The session to create. |
||||||||||||||||
Properties
|
A Cloud Spanner database.
Name | Data Type | Description |
---|---|---|
name
|
string |
Required. The name of the database. Values are of the form
|
state
|
string Allowed values: - STATE_UNSPECIFIED - CREATING - READY |
Output only. The current database state. |
A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance:
service Foo {
rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
}
The JSON representation for Empty
is empty JSON object {}
.
Name | Data Type | Description |
---|---|---|
Empty
|
object |
A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance:
The JSON representation for |
The request for ExecuteBatchDml.
Name | Data Type | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
seqno
|
string |
Required. 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 will succeed. 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 may be aborted. Replays of previously handled requests will yield the same response as the first execution. |
|||||||||||||||||||||||||||||||||||||||||||||
statements
|
array [Statement] |
Required. The list of statements to execute in this batch. Statements are executed
serially, such that the effects of statement Callers must provide at least one statement. |
|||||||||||||||||||||||||||||||||||||||||||||
Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||
transaction
|
TransactionSelector |
Required. The transaction to use. Must be 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. |
|||||||||||||||||||||||||||||||||||||||||||||
Properties
|
The response for ExecuteBatchDml. Contains a list of 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:
OK
indicates that all statements were executed successfully.OK
, check the number of result sets in the
response. If the response contains N
ResultSet messages, then
statement N+1
in the request failed.Example 1:
OK
.Example 2:
INVALID_ARGUMENT
)
status. The number of ResultSet messages indicates that the third
statement failed, and the fourth and fifth statements were not executed.Name | Data Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
resultSets
|
array [ResultSet] |
One ResultSet for each statement in the request that ran successfully, in the same order as the statements in the request. Each ResultSet does not contain any rows. The ResultSetStats in each ResultSet contain the number of rows modified by the statement. Only the first ResultSet in the response contains valid ResultSetMetadata. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
status
|
Status |
If all DML statements are executed successfully, the status is |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
The request for ExecuteSql and ExecuteStreamingSql.
Name | Data Type | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
paramTypes
|
object |
It is not always possible for Cloud Spanner to infer the right SQL type
from a JSON value. For example, values of type In these cases, |
|||||||||||||||||||||||||||||||||||||||||||||
params
|
object |
Parameter names and values that bind to placeholders in the SQL string. A parameter placeholder consists of the Parameters can appear anywhere that a literal value is expected. The same parameter name can be used more than once, for example:
It is an error to execute a SQL statement with unbound parameters. |
|||||||||||||||||||||||||||||||||||||||||||||
partitionToken
|
byte |
If present, results will be 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. |
|||||||||||||||||||||||||||||||||||||||||||||
queryMode
|
string Allowed values: - NORMAL - PLAN - PROFILE |
Used to control the amount of debugging information returned in ResultSetStats. If partition_token is set, query_mode can only be set to QueryMode.NORMAL. |
|||||||||||||||||||||||||||||||||||||||||||||
resumeToken
|
byte |
If this request is resuming a previously interrupted SQL statement
execution, |
|||||||||||||||||||||||||||||||||||||||||||||
seqno
|
string |
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 will succeed. 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 may be aborted. Replays of previously handled requests will yield the same response as the first execution. Required for DML statements. Ignored for queries. |
|||||||||||||||||||||||||||||||||||||||||||||
sql
|
string |
Required. The SQL string. |
|||||||||||||||||||||||||||||||||||||||||||||
transaction
|
TransactionSelector |
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. |
|||||||||||||||||||||||||||||||||||||||||||||
Properties
|
The response for GetDatabaseDdl.
Name | Data Type | Description |
---|---|---|
statements
|
array [string] |
A list of formatted DDL statements defining the schema of the database specified in the request. |
Request message for GetIamPolicy
method.
Name | Data Type | Description | |||||||
---|---|---|---|---|---|---|---|---|---|
options
|
GetPolicyOptions |
OPTIONAL: A |
|||||||
Properties
|
Encapsulates settings provided to GetIamPolicy.
Name | Data Type | Description |
---|---|---|
requestedPolicyVersion
|
integer |
Optional. The policy format version to be returned. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional bindings must specify version 3. Policies without any conditional bindings may specify any valid value or leave the field unset. |
An isolated set of Cloud Spanner resources on which databases can be hosted.
Name | Data Type | Description |
---|---|---|
config
|
string |
Required. The name of the instance's configuration. Values are of the form
|
displayName
|
string |
Required. The descriptive name for this instance as it appears in UIs. Must be unique per project and between 4 and 30 characters in length. |
endpointUris
|
array [] |
Output only. A set of endpoint URIs based on your instance config
that you can use instead of the global endpoint For example, if your instance config is The client libraries, JDBC drivers, and other SDK clients automatically call these instance specific endpoints. If you are using DNS whitelists, firewalls, or filtering to control access
to endpoints, make sure you grant access to |
labels
|
object |
Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources into groups that reflect a customer's organizational needs and deployment strategies. Cloud Labels can be used to filter collections of resources. They can be used to control how resource metrics are aggregated. And they can be used as arguments to policy management rules (e.g. route, firewall, load balancing, etc.).
See https://goo.gl/xmQnxf for more information on and examples of labels. If you plan to use labels in your own code, please note that additional characters may be allowed in the future. And so you are advised to use an internal label representation, such as JSON, which doesn't rely upon specific characters being disallowed. For example, representing labels as the string: name + "" + value would prove problematic if we were to allow "" in a future release. |
name
|
string |
Required. A unique identifier for the instance, which cannot be changed
after the instance is created. Values are of the form
|
nodeCount
|
integer |
The number of nodes allocated to this instance. This
may be zero in API responses for instances that are not yet in state
See the documentation for more information about nodes. |
state
|
string Allowed values: - STATE_UNSPECIFIED - CREATING - READY |
Output only. The current instance state. For
CreateInstance, the state must be
either omitted or set to |
A possible configuration for a Cloud Spanner instance. Configurations define the geographic placement of nodes and their replication.
Name | Data Type | Description | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
displayName
|
string |
The name of this instance configuration as it appears in UIs. |
|||||||||||||
name
|
string |
A unique identifier for the instance configuration. Values
are of the form
|
|||||||||||||
replicas
|
array [ReplicaInfo] |
The geographic placement of nodes in this instance configuration and their replication properties. |
|||||||||||||
Properties
|
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.
Name | Data Type | Description |
---|---|---|
all
|
boolean |
For convenience |
keys
|
array [] |
A list of specific keys. Entries in |
ranges
|
array [KeyRange] |
A list of key ranges. See KeyRange for more information about key range specifications. |
The response for ListDatabases.
Name | Data Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
databases
|
array [Database] |
Databases that matched the request. |
||||||||||
Properties
|
||||||||||||
nextPageToken
|
string |
|
The response for ListInstanceConfigs.
Name | Data Type | Description | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
instanceConfigs
|
array [InstanceConfig] |
The list of requested instance configurations. |
|||||||||||||||||||||||||||||
Properties
|
|||||||||||||||||||||||||||||||
nextPageToken
|
string |
|
The response for ListInstances.
Name | Data Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
instances
|
array [Instance] |
The list of requested instances. |
|||||||||||||||||||||||||
Properties
|
|||||||||||||||||||||||||||
nextPageToken
|
string |
|
The response for ListSessions.
Name | Data Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
nextPageToken
|
string |
|
||||||||||||||||
sessions
|
array [Session] |
The list of requested sessions. |
||||||||||||||||
Properties
|
A modification to one or more Cloud Spanner rows. Mutations can be applied to a Cloud Spanner database by sending them in a Commit call.
Name | Data Type | Description |
---|---|---|
delete
|
Delete |
Delete rows from a table. Succeeds whether or not the named rows were present. |
insert
|
Write |
Insert new rows in a table. If any of the rows already exist,
the write or transaction fails with error |
insertOrUpdate
|
Write |
Like insert, except that if the row already exists, then its column values are overwritten with the ones provided. Any column values not explicitly written are preserved. When using insert_or_update, just as when using insert, all |
replace
|
Write |
Like insert, except that if the row already exists, it is
deleted, and the column values provided are inserted
instead. Unlike insert_or_update, this means any values not
explicitly written become In an interleaved table, if you create the child table with the
|
update
|
Write |
Update existing rows in a table. If any of the rows does not
already exist, the transaction fails with error |
This resource represents a long-running operation that is the result of a network API call.
Name | Data Type | Description | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
done
|
boolean |
If the value is |
|||||||||||||
error
|
Status |
The error result of the operation in case of failure or cancellation. |
|||||||||||||
Properties
|
|||||||||||||||
metadata
|
object |
Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. |
|||||||||||||
name
|
string |
The server-assigned name, which is only unique within the same service that
originally returns it. If you use the default HTTP mapping, the
|
|||||||||||||
response
|
object |
The normal response of the operation in case of success. If the original
method returns no data on success, such as |
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.
Name | Data Type | Description | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
chunkedValue
|
boolean |
If true, then the final value in values is chunked, and must
be combined with more values from subsequent |
|||||||||||||||||||||||
metadata
|
ResultSetMetadata |
Metadata about the result set, such as row type information. Only present in the first response. |
|||||||||||||||||||||||
Properties
|
|||||||||||||||||||||||||
resumeToken
|
byte |
Streaming calls might be interrupted for a variety of reasons, such
as TCP connection loss. If this occurs, the stream of results can
be resumed by re-sending the original request and including
|
|||||||||||||||||||||||
stats
|
ResultSetStats |
Query plan and execution statistics for the statement that produced this streaming result set. These can be requested by setting ExecuteSqlRequest.query_mode and are sent only once with the last response in the stream. This field will also be present in the last response for DML statements. |
|||||||||||||||||||||||
Properties
|
|||||||||||||||||||||||||
values
|
array [] |
A streamed result set consists of a stream of values, which might
be split into many Most values are encoded based on type as described here. It is possible that the last value in values is "chunked",
meaning that the rest of the value is sent in subsequent
Some examples of merging:
For a more complete example, suppose a streaming SQL query is
yielding a result set whose rows contain a single string
field. The following
This sequence of |
Information returned for each partition returned in a PartitionResponse.
Name | Data Type | Description |
---|---|---|
partitionToken
|
byte |
This token can be passed to Read, StreamingRead, ExecuteSql, or ExecuteStreamingSql requests to restrict the results to those identified by this partition token. |
Options for a PartitionQueryRequest and PartitionReadRequest.
Name | Data Type | Description |
---|---|---|
maxPartitions
|
string |
Note: This hint is currently ignored by PartitionQuery and PartitionRead requests. The desired maximum number of partitions to return. For example, this may be set to the number of workers available. The default for this option is currently 10,000. The maximum value is currently 200,000. This is only a hint. The actual number of partitions returned may be smaller or larger than this maximum count request. |
partitionSizeBytes
|
string |
Note: This hint is currently ignored by PartitionQuery and PartitionRead requests. The desired data size for each partition generated. The default for this option is currently 1 GiB. This is only a hint. The actual size of each partition may be smaller or larger than this size request. |
The request for PartitionQuery
Name | Data Type | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
paramTypes
|
object |
It is not always possible for Cloud Spanner to infer the right SQL type
from a JSON value. For example, values of type In these cases, |
|||||||||||||||||||||||||||||||||||||||||||||
params
|
object |
Parameter names and values that bind to placeholders in the SQL string. A parameter placeholder consists of the Parameters can appear anywhere that a literal value is expected. The same parameter name can be used more than once, for example:
It is an error to execute a SQL statement with unbound parameters. |
|||||||||||||||||||||||||||||||||||||||||||||
partitionOptions
|
PartitionOptions |
Additional options that affect how many partitions are created. |
|||||||||||||||||||||||||||||||||||||||||||||
Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||
sql
|
string |
Required. The query request to generate partitions for. The request will fail if the query is not root partitionable. The query plan of a root partitionable query has a single distributed union operator. A distributed union operator conceptually divides one or more tables into multiple splits, remotely evaluates a subquery independently on each split, and then unions all results. This must not contain DML commands, such as INSERT, UPDATE, or DELETE. Use ExecuteStreamingSql with a PartitionedDml transaction for large, partition-friendly DML operations. |
|||||||||||||||||||||||||||||||||||||||||||||
transaction
|
TransactionSelector |
Read only snapshot transactions are supported, read/write and single use transactions are not. |
|||||||||||||||||||||||||||||||||||||||||||||
Properties
|
The request for PartitionRead
Name | Data Type | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
columns
|
array [string] |
The columns of table to be returned for each row matching this request. |
|||||||||||||||||||||||||||||||||||||||||||||
index
|
string |
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. |
|||||||||||||||||||||||||||||||||||||||||||||
keySet
|
KeySet |
Required. It is not an error for the |
|||||||||||||||||||||||||||||||||||||||||||||
Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||
partitionOptions
|
PartitionOptions |
Additional options that affect how many partitions are created. |
|||||||||||||||||||||||||||||||||||||||||||||
Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||
table
|
string |
Required. The name of the table in the database to be read. |
|||||||||||||||||||||||||||||||||||||||||||||
transaction
|
TransactionSelector |
Read only snapshot transactions are supported, read/write and single use transactions are not. |
|||||||||||||||||||||||||||||||||||||||||||||
Properties
|
The response for PartitionQuery or PartitionRead
Name | Data Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
partitions
|
array [Partition] |
Partitions created by this request. |
||||||||||
Properties
|
||||||||||||
transaction
|
Transaction |
Transaction created by this request. |
||||||||||
Properties
|
An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources.
A Policy
is a collection of bindings
. A binding
binds one or more
members
to a single role
. Members can be user accounts, service accounts,
Google groups, and domains (such as G Suite). A role
is a named list of
permissions; each role
can be an IAM predefined role or a user-created
custom role.
Optionally, a binding
can specify a condition
, which is a logical
expression that allows access to a resource only if the expression evaluates
to true
. A condition can add constraints based on attributes of the
request, the resource, or both.
JSON example:
{
"bindings": [
{
"role": "roles/resourcemanager.organizationAdmin",
"members": [
"user:mike@example.com",
"group:admins@example.com",
"domain:google.com",
"serviceAccount:my-project-id@appspot.gserviceaccount.com"
]
},
{
"role": "roles/resourcemanager.organizationViewer",
"members": ["user:eve@example.com"],
"condition": {
"title": "expirable access",
"description": "Does not grant access after Sep 2020",
"expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')",
}
}
],
"etag": "BwWWja0YfJA=",
"version": 3
}
YAML example:
bindings:
- members:
- user:mike@example.com
- group:admins@example.com
- domain:google.com
- serviceAccount:my-project-id@appspot.gserviceaccount.com
role: roles/resourcemanager.organizationAdmin
- members:
- user:eve@example.com
role: roles/resourcemanager.organizationViewer
condition:
title: expirable access
description: Does not grant access after Sep 2020
expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
- etag: BwWWja0YfJA=
- version: 3
For a description of IAM and its features, see the IAM documentation.
Name | Data Type | Description | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bindings
|
array [Binding] |
Associates a list of |
|||||||||||||
Properties
|
|||||||||||||||
etag
|
byte |
Important: If you use IAM Conditions, you must include the |
|||||||||||||
version
|
integer |
Specifies the format of the policy. Valid values are Any operation that affects conditional role bindings must specify version
Important: If you use IAM Conditions, you must include the If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. |
The request for Read and StreamingRead.
Name | Data Type | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
columns
|
array [string] |
Required. The columns of table to be returned for each row matching this request. |
|||||||||||||||||||||||||||||||||||||||||||||
index
|
string |
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. |
|||||||||||||||||||||||||||||||||||||||||||||
keySet
|
KeySet |
Required. If the partition_token field is empty, rows are yielded in table primary key order (if index is empty) or index key order (if index is non-empty). If the partition_token field is not empty, rows will be yielded in an unspecified order. It is not an error for the |
|||||||||||||||||||||||||||||||||||||||||||||
Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||
limit
|
string |
If greater than zero, only the first |
|||||||||||||||||||||||||||||||||||||||||||||
partitionToken
|
byte |
If present, results will be 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. |
|||||||||||||||||||||||||||||||||||||||||||||
resumeToken
|
byte |
If this request is resuming a previously interrupted read,
|
|||||||||||||||||||||||||||||||||||||||||||||
table
|
string |
Required. The name of the table in the database to be read. |
|||||||||||||||||||||||||||||||||||||||||||||
transaction
|
TransactionSelector |
The transaction to use. If none is provided, the default is a temporary read-only transaction with strong concurrency. |
|||||||||||||||||||||||||||||||||||||||||||||
Properties
|
Name | Data Type | Description |
---|---|---|
defaultLeaderLocation
|
boolean |
If true, this location is designated as the default leader location where leader replicas are placed. See the region types documentation for more details. |
location
|
string |
The location of the serving resources, e.g. "us-central1". |
type
|
string Allowed values: - TYPE_UNSPECIFIED - READ_WRITE - READ_ONLY - WITNESS |
The type of replica. |
Results from Read or ExecuteSql.
Name | Data Type | Description | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
metadata
|
ResultSetMetadata |
Metadata about the result set, such as row type information. |
|||||||||||||||||||||||
Properties
|
|||||||||||||||||||||||||
rows
|
array [array] |
Each element in |
|||||||||||||||||||||||
stats
|
ResultSetStats |
Query plan and execution statistics for the SQL statement that produced this result set. These can be requested by setting ExecuteSqlRequest.query_mode. DML statements always produce stats containing the number of rows modified, unless executed using the ExecuteSqlRequest.QueryMode.PLAN ExecuteSqlRequest.query_mode. Other fields may or may not be populated, based on the ExecuteSqlRequest.query_mode. |
|||||||||||||||||||||||
Properties
|
Metadata about a ResultSet or PartialResultSet.
Name | Data Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
rowType
|
StructType |
Indicates the field names and types for the rows in the result
set. For example, a SQL query like
|
||||||||||
transaction
|
Transaction |
If the read or SQL query began a transaction as a side-effect, the information about the new transaction is yielded here. |
||||||||||
Properties
|
Additional statistics about a ResultSet or PartialResultSet.
Name | Data Type | Description |
---|---|---|
queryPlan
|
QueryPlan |
QueryPlan for the query associated with this result. |
queryStats
|
object |
Aggregated statistics from the execution of the query. Only present when the query is profiled. For example, a query could return the statistics as follows:
|
rowCountExact
|
string |
Standard DML returns an exact count of rows that were modified. |
rowCountLowerBound
|
string |
Partitioned DML does not offer exactly-once semantics, so it returns a lower bound of the rows modified. |
The request for Rollback.
Name | Data Type | Description |
---|---|---|
transactionId
|
byte |
Required. The transaction to roll back. |
A session in the Cloud Spanner API.
Name | Data Type | Description |
---|---|---|
approximateLastUseTime
|
string |
Output only. The approximate timestamp when the session is last used. It is typically earlier than the actual last use time. |
createTime
|
string |
Output only. The timestamp when the session is created. |
labels
|
object |
The labels for the session.
See https://goo.gl/xmQnxf for more information on and examples of labels. |
name
|
string |
The name of the session. This is always system-assigned; values provided when creating a session are ignored. |
Request message for SetIamPolicy
method.
Name | Data Type | Description | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
policy
|
Policy |
REQUIRED: The complete policy to be applied to the |
|||||||||||||||||||||||||||||
Properties
|
A single DML statement.
Name | Data Type | Description |
---|---|---|
paramTypes
|
object |
It is not always possible for Cloud Spanner to infer the right SQL type
from a JSON value. For example, values of type In these cases, |
params
|
object |
Parameter names and values that bind to placeholders in the DML string. A parameter placeholder consists of the Parameters can appear anywhere that a literal value is expected. The same parameter name can be used more than once, for example:
It is an error to execute a SQL statement with unbound parameters. |
sql
|
string |
Required. The DML string. |
The Status
type defines a logical error model that is suitable for
different programming environments, including REST APIs and RPC APIs. It is
used by gRPC. Each Status
message contains
three pieces of data: error code, error message, and error details.
You can find out more about this error model and how to work with it in the API Design Guide.
Name | Data Type | Description |
---|---|---|
code
|
integer |
The status code, which should be an enum value of google.rpc.Code. |
details
|
array [] |
A list of messages that carry the error details. There is a common set of message types for APIs to use. |
message
|
string |
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client. |
Request message for TestIamPermissions
method.
Name | Data Type | Description |
---|---|---|
permissions
|
array [string] |
REQUIRED: The set of permissions to check for 'resource'. Permissions with wildcards (such as '', 'spanner.', 'spanner.instances.*') are not allowed. |
Response message for TestIamPermissions
method.
Name | Data Type | Description |
---|---|---|
permissions
|
array [string] |
A subset of |
A transaction.
Name | Data Type | Description |
---|---|---|
id
|
byte |
Single-use read-only transactions do not have IDs, because single-use transactions do not support multiple requests. |
readTimestamp
|
string |
For snapshot read-only transactions, the read timestamp chosen for the transaction. Not returned by default: see TransactionOptions.ReadOnly.return_read_timestamp. A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds.
Example: |
Each session can have at most one active transaction at a time. After the active transaction is completed, the session can immediately be re-used for the next transaction. It is not necessary to create a new session for each transaction.
Cloud Spanner supports three transaction modes:
Locking read-write. This type of transaction is the only way to write data into Cloud Spanner. These transactions rely on pessimistic locking and, if necessary, two-phase commit. Locking read-write transactions may abort, requiring the application to retry.
Snapshot read-only. This transaction type provides guaranteed consistency across several reads, but does not allow writes. Snapshot read-only transactions can be configured to read at timestamps in the past. Snapshot read-only transactions do not need to be committed.
Partitioned DML. This type of transaction is used to execute a single Partitioned DML statement. Partitioned DML partitions the key space and runs the DML statement over each partition in parallel using separate, internal transactions that commit independently. Partitioned DML transactions do not need to be committed.
For transactions that only read, snapshot read-only transactions provide simpler semantics and are almost always faster. In particular, read-only transactions do not take locks, so they do not conflict with read-write transactions. As a consequence of not taking locks, they also do not abort, so retry loops are not needed.
Transactions may only read/write data in a single database. They may, however, read/write data in different tables within that database.
Locking transactions may be used to atomically read-modify-write data anywhere in a database. This type of transaction is externally consistent.
Clients should attempt to minimize the amount of time a transaction is active. Faster transactions commit with higher probability and cause less contention. Cloud Spanner attempts to keep read locks active as long as the transaction continues to do reads, and the transaction has not been terminated by Commit or Rollback. Long periods of inactivity at the client may cause Cloud Spanner to release a transaction's locks and abort it.
Conceptually, a read-write transaction consists of zero or more reads or SQL statements followed by Commit. At any time before Commit, the client can send a Rollback request to abort the transaction.
Cloud Spanner can commit the transaction if all read locks it acquired
are still valid at commit time, and it is able to acquire write
locks for all writes. Cloud Spanner can abort the transaction for any
reason. If a commit attempt returns ABORTED
, Cloud Spanner guarantees
that the transaction has not modified any user data in Cloud Spanner.
Unless the transaction commits, Cloud Spanner makes no guarantees about how long the transaction's locks were held for. It is an error to use Cloud Spanner locks for any sort of mutual exclusion other than between Cloud Spanner transactions themselves.
When a transaction aborts, the application can choose to retry the whole transaction again. To maximize the chances of successfully committing the retry, the client should execute the retry in the same session as the original attempt. The original session's lock priority increases with each consecutive abort, meaning that each attempt has a slightly better chance of success than the previous.
Under some circumstances (e.g., many transactions attempting to modify the same row(s)), a transaction can abort many times in a short period before successfully committing. Thus, it is not a good idea to cap the number of retries a transaction can attempt; instead, it is better to limit the total amount of wall time spent retrying.
A transaction is considered idle if it has no outstanding reads or
SQL queries and has not started a read or SQL query within the last 10
seconds. Idle transactions can be aborted by Cloud Spanner so that they
don't hold on to locks indefinitely. In that case, the commit will
fail with error ABORTED
.
If this behavior is undesirable, periodically executing a simple
SQL query in the transaction (e.g., SELECT 1
) prevents the
transaction from becoming idle.
Snapshot read-only transactions provides a simpler method than locking read-write transactions for doing several consistent reads. However, this type of transaction does not support writes.
Snapshot transactions do not take locks. Instead, they work by choosing a Cloud Spanner timestamp, then executing all reads at that timestamp. Since they do not acquire locks, they do not block concurrent read-write transactions.
Unlike locking read-write transactions, snapshot read-only transactions never abort. They can fail if the chosen read timestamp is garbage collected; however, the default garbage collection policy is generous enough that most applications do not need to worry about this in practice.
Snapshot read-only transactions do not need to call Commit or Rollback (and in fact are not permitted to do so).
To execute a snapshot transaction, the client specifies a timestamp bound, which tells Cloud Spanner how to choose a read timestamp.
The types of timestamp bound are:
If the Cloud Spanner database to be read is geographically distributed, stale read-only transactions can execute more quickly than strong or read-write transaction, because they are able to execute far from the leader replica.
Each type of timestamp bound is discussed in detail below.
Strong reads are guaranteed to see the effects of all transactions that have committed before the start of the read. Furthermore, all rows yielded by a single read are consistent with each other -- if any part of the read observes a transaction, all parts of the read see the transaction.
Strong reads are not repeatable: two consecutive strong read-only transactions might return inconsistent results if there are concurrent writes. If consistency across reads is required, the reads should be executed within a transaction or at an exact read timestamp.
See TransactionOptions.ReadOnly.strong.
These timestamp bounds execute reads at a user-specified timestamp. Reads at a timestamp are guaranteed to see a consistent prefix of the global transaction history: they observe modifications done by all transactions with a commit timestamp <= the read timestamp, and observe none of the modifications done by transactions with a larger commit timestamp. They will block until all conflicting transactions that may be assigned commit timestamps <= the read timestamp have finished.
The timestamp can either be expressed as an absolute Cloud Spanner commit timestamp or a staleness relative to the current time.
These modes do not require a "negotiation phase" to pick a timestamp. As a result, they execute slightly faster than the equivalent boundedly stale concurrency modes. On the other hand, boundedly stale reads usually return fresher results.
See TransactionOptions.ReadOnly.read_timestamp and TransactionOptions.ReadOnly.exact_staleness.
Bounded staleness modes allow Cloud Spanner to pick the read timestamp, subject to a user-provided staleness bound. Cloud Spanner chooses the newest timestamp within the staleness bound that allows execution of the reads at the closest available replica without blocking.
All rows yielded are consistent with each other -- if any part of the read observes a transaction, all parts of the read see the transaction. Boundedly stale reads are not repeatable: two stale reads, even if they use the same staleness bound, can execute at different timestamps and thus return inconsistent results.
Boundedly stale reads execute in two phases: the first phase negotiates a timestamp among all replicas needed to serve the read. In the second phase, reads are executed at the negotiated timestamp.
As a result of the two phase execution, bounded staleness reads are usually a little slower than comparable exact staleness reads. However, they are typically able to return fresher results, and are more likely to execute at the closest replica.
Because the timestamp negotiation requires up-front knowledge of which rows will be read, it can only be used with single-use read-only transactions.
See TransactionOptions.ReadOnly.max_staleness and TransactionOptions.ReadOnly.min_read_timestamp.
Cloud Spanner continuously garbage collects deleted and overwritten data
in the background to reclaim storage space. This process is known
as "version GC". By default, version GC reclaims versions after they
are one hour old. Because of this, Cloud Spanner cannot perform reads
at read timestamps more than one hour in the past. This
restriction also applies to in-progress reads and/or SQL queries whose
timestamp become too old while executing. Reads and SQL queries with
too-old read timestamps fail with the error FAILED_PRECONDITION
.
Partitioned DML transactions are used to execute DML statements with a different execution strategy that provides different, and often better, scalability properties for large, table-wide operations than DML in a ReadWrite transaction. Smaller scoped statements, such as an OLTP workload, should prefer using ReadWrite transactions.
Partitioned DML partitions the keyspace and runs the DML statement on each partition in separate, internal transactions. These transactions commit automatically when complete, and run independently from one another.
To reduce lock contention, this execution strategy only acquires read locks on rows that match the WHERE clause of the statement. Additionally, the smaller per-partition transactions hold locks for less time.
That said, Partitioned DML is not a drop-in replacement for standard DML used in ReadWrite transactions.
The DML statement must be fully-partitionable. Specifically, the statement must be expressible as the union of many statements which each access only a single row of the table.
The statement is not applied atomically to all rows of the table. Rather, the statement is applied atomically to partitions of the table, in independent transactions. Secondary index rows are updated atomically with the base table rows.
Partitioned DML does not guarantee exactly-once execution semantics
against a partition. The statement will be applied at least once to each
partition. It is strongly recommended that the DML statement should be
idempotent to avoid unexpected results. For instance, it is potentially
dangerous to run a statement such as
UPDATE table SET column = column + 1
as it could be run multiple times
against some rows.
The partitions are committed automatically - there is no support for Commit or Rollback. If the call returns an error, or if the client issuing the ExecuteSql call dies, it is possible that some rows had the statement executed on them successfully. It is also possible that statement was never executed against other rows.
Partitioned DML transactions may only contain the execution of a single DML statement via ExecuteSql or ExecuteStreamingSql.
If any error is encountered during the execution of the partitioned DML operation (for instance, a UNIQUE INDEX violation, division by zero, or a value that cannot be stored due to schema constraints), then the operation is stopped at that point and an error is returned. It is possible that at this point, some partitions have been committed (or even committed multiple times), and other partitions have not been run at all.
Given the above, Partitioned DML is good fit for large, database-wide, operations that are idempotent, such as deleting old rows from a very large table.
Name | Data Type | Description |
---|---|---|
partitionedDml
|
PartitionedDml |
Partitioned DML transaction. Authorization to begin a Partitioned DML transaction requires
|
readOnly
|
ReadOnly |
Transaction will not write. Authorization to begin a read-only transaction requires
|
readWrite
|
ReadWrite |
Transaction may write. Authorization to begin a read-write transaction requires
|
This message is used to select the transaction in which a Read or ExecuteSql call runs.
See TransactionOptions for more information about transactions.
Name | Data Type | Description | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
begin
|
TransactionOptions |
Begin a new transaction and execute this read or SQL query in it. The transaction ID of the new transaction is returned in ResultSetMetadata.transaction, which is a Transaction. |
|||||||||||||
Properties
|
|||||||||||||||
id
|
byte |
Execute the read or SQL query in a previously-started transaction. |
|||||||||||||
singleUse
|
TransactionOptions |
Execute the read or SQL query in a temporary transaction. This is the most efficient way to execute a transaction that consists of a single SQL query. |
|||||||||||||
Properties
|
Enqueues the given DDL statements to be applied, in order but not
necessarily all at once, to the database schema at some point (or
points) in the future. The server checks that the statements
are executable (syntactically valid, name tables that exist, etc.)
before enqueueing them, but they may still fail upon
later execution (e.g., if a statement from another batch of
statements is applied first and it conflicts in some way, or if
there is some data-related problem like a NULL
value in a column to
which NOT NULL
would be added). If a statement fails, all
subsequent statements in the batch are automatically cancelled.
Each batch of statements is assigned a name which can be used with the Operations API to monitor progress. See the operation_id field for more details.
Name | Data Type | Description |
---|---|---|
operationId
|
string |
If empty, the new update request is assigned an
automatically-generated operation ID. Otherwise, Specifying an explicit operation ID simplifies determining
whether the statements were executed in the event that the
UpdateDatabaseDdl call is replayed,
or the return value is otherwise lost: the database and
|
statements
|
array [string] |
Required. DDL statements to be applied to the database. |
The request for UpdateInstance.
Name | Data Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fieldMask
|
string |
Required. A mask specifying which fields in Instance should be updated. The field mask must always be specified; this prevents any future fields in Instance from being erased accidentally by clients that do not know about them. |
|||||||||||||||||||||||||
instance
|
Instance |
Required. The instance to update, which must always include the instance name. Otherwise, only fields mentioned in field_mask need be included. |
|||||||||||||||||||||||||
Properties
|
Name | Google |
External URL | https://google.com |
OAS (OpenAPI Specification) | v3.0.0 |