Publish `QueryOptions` proto.

Introduced a `query_options` input in `ExecuteSqlRequest`.

PiperOrigin-RevId: 297497710
pull/592/head
Google APIs 5 years ago committed by Copybara-Service
parent dafc905f71
commit dfe1cf7be4
  1. 85
      google/spanner/admin/database/v1/spanner_database_admin.proto
  2. 17
      google/spanner/admin/instance/v1/spanner_instance_admin.proto
  3. 3
      google/spanner/v1/keys.proto
  4. 12
      google/spanner/v1/mutation.proto
  5. 3
      google/spanner/v1/query_plan.proto
  6. 3
      google/spanner/v1/result_set.proto
  7. 317
      google/spanner/v1/spanner.proto
  8. 3
      google/spanner/v1/transaction.proto
  9. 3
      google/spanner/v1/type.proto

@ -1,4 +1,4 @@
// Copyright 2019 Google LLC. // Copyright 2020 Google LLC
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//
syntax = "proto3"; syntax = "proto3";
@ -33,10 +32,6 @@ option java_multiple_files = true;
option java_outer_classname = "SpannerDatabaseAdminProto"; option java_outer_classname = "SpannerDatabaseAdminProto";
option java_package = "com.google.spanner.admin.database.v1"; option java_package = "com.google.spanner.admin.database.v1";
option php_namespace = "Google\\Cloud\\Spanner\\Admin\\Database\\V1"; option php_namespace = "Google\\Cloud\\Spanner\\Admin\\Database\\V1";
// The Instance resource is defined in `google.spanner.admin.instance.v1`.
// Because this is a separate, independent API (technically), we redefine
// the resource name pattern here.
option (google.api.resource_definition) = { option (google.api.resource_definition) = {
type: "spanner.googleapis.com/Instance" type: "spanner.googleapis.com/Instance"
pattern: "projects/{project}/instances/{instance}" pattern: "projects/{project}/instances/{instance}"
@ -66,11 +61,10 @@ service DatabaseAdmin {
// have a name of the format `<database_name>/operations/<operation_id>` and // have a name of the format `<database_name>/operations/<operation_id>` and
// can be used to track preparation of the database. The // can be used to track preparation of the database. The
// [metadata][google.longrunning.Operation.metadata] field type is // [metadata][google.longrunning.Operation.metadata] field type is
// [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. // [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. The
// The [response][google.longrunning.Operation.response] field type is // [response][google.longrunning.Operation.response] field type is
// [Database][google.spanner.admin.database.v1.Database], if successful. // [Database][google.spanner.admin.database.v1.Database], if successful.
rpc CreateDatabase(CreateDatabaseRequest) rpc CreateDatabase(CreateDatabaseRequest) returns (google.longrunning.Operation) {
returns (google.longrunning.Operation) {
option (google.api.http) = { option (google.api.http) = {
post: "/v1/{parent=projects/*/instances/*}/databases" post: "/v1/{parent=projects/*/instances/*}/databases"
body: "*" body: "*"
@ -96,10 +90,8 @@ service DatabaseAdmin {
// the format `<database_name>/operations/<operation_id>` and can be used to // the format `<database_name>/operations/<operation_id>` and can be used to
// track execution of the schema change(s). The // track execution of the schema change(s). The
// [metadata][google.longrunning.Operation.metadata] field type is // [metadata][google.longrunning.Operation.metadata] field type is
// [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. // [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. The operation has no response.
// The operation has no response. rpc UpdateDatabaseDdl(UpdateDatabaseDdlRequest) returns (google.longrunning.Operation) {
rpc UpdateDatabaseDdl(UpdateDatabaseDdlRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = { option (google.api.http) = {
patch: "/v1/{database=projects/*/instances/*/databases/*}/ddl" patch: "/v1/{database=projects/*/instances/*/databases/*}/ddl"
body: "*" body: "*"
@ -134,8 +126,7 @@ service DatabaseAdmin {
// //
// Authorization requires `spanner.databases.setIamPolicy` // Authorization requires `spanner.databases.setIamPolicy`
// permission on [resource][google.iam.v1.SetIamPolicyRequest.resource]. // permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].
rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) {
returns (google.iam.v1.Policy) {
option (google.api.http) = { option (google.api.http) = {
post: "/v1/{resource=projects/*/instances/*/databases/*}:setIamPolicy" post: "/v1/{resource=projects/*/instances/*/databases/*}:setIamPolicy"
body: "*" body: "*"
@ -153,8 +144,7 @@ service DatabaseAdmin {
// //
// Authorization requires `spanner.databases.getIamPolicy` permission on // Authorization requires `spanner.databases.getIamPolicy` permission on
// [resource][google.iam.v1.GetIamPolicyRequest.resource]. // [resource][google.iam.v1.GetIamPolicyRequest.resource].
rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) {
returns (google.iam.v1.Policy) {
option (google.api.http) = { option (google.api.http) = {
post: "/v1/{resource=projects/*/instances/*/databases/*}:getIamPolicy" post: "/v1/{resource=projects/*/instances/*/databases/*}:getIamPolicy"
body: "*" body: "*"
@ -172,8 +162,7 @@ service DatabaseAdmin {
// result in a NOT_FOUND error if the user has // result in a NOT_FOUND error if the user has
// `spanner.databases.list` permission on the containing Cloud // `spanner.databases.list` permission on the containing Cloud
// Spanner instance. Otherwise returns an empty set of permissions. // Spanner instance. Otherwise returns an empty set of permissions.
rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) {
returns (google.iam.v1.TestIamPermissionsResponse) {
option (google.api.http) = { option (google.api.http) = {
post: "/v1/{resource=projects/*/instances/*/databases/*}:testIamPermissions" post: "/v1/{resource=projects/*/instances/*/databases/*}:testIamPermissions"
body: "*" body: "*"
@ -217,8 +206,7 @@ message Database {
State state = 2; State state = 2;
} }
// The request for // The request for [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
// [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
message ListDatabasesRequest { message ListDatabasesRequest {
// Required. The instance whose databases should be listed. // Required. The instance whose databases should be listed.
// Values are of the form `projects/<project>/instances/<instance>`. // Values are of the form `projects/<project>/instances/<instance>`.
@ -234,26 +222,23 @@ message ListDatabasesRequest {
int32 page_size = 3; int32 page_size = 3;
// If non-empty, `page_token` should contain a // If non-empty, `page_token` should contain a
// [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token] // [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token] from a
// from a previous // previous [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse].
// [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse].
string page_token = 4; string page_token = 4;
} }
// The response for // The response for [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
// [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
message ListDatabasesResponse { message ListDatabasesResponse {
// Databases that matched the request. // Databases that matched the request.
repeated Database databases = 1; repeated Database databases = 1;
// `next_page_token` can be sent in a subsequent // `next_page_token` can be sent in a subsequent
// [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases] // [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases] call to fetch more
// call to fetch more of the matching databases. // of the matching databases.
string next_page_token = 2; string next_page_token = 2;
} }
// The request for // The request for [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].
// [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].
message CreateDatabaseRequest { message CreateDatabaseRequest {
// Required. The name of the instance that will serve the new database. // Required. The name of the instance that will serve the new database.
// Values are of the form `projects/<project>/instances/<instance>`. // Values are of the form `projects/<project>/instances/<instance>`.
@ -283,12 +268,11 @@ message CreateDatabaseRequest {
message CreateDatabaseMetadata { message CreateDatabaseMetadata {
// The database being created. // The database being created.
string database = 1 [(google.api.resource_reference) = { string database = 1 [(google.api.resource_reference) = {
type: "spanner.googleapis.com/Database" type: "spanner.googleapis.com/Database"
}]; }];
} }
// The request for // The request for [GetDatabase][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabase].
// [GetDatabase][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabase].
message GetDatabaseRequest { message GetDatabaseRequest {
// Required. The name of the requested database. Values are of the form // Required. The name of the requested database. Values are of the form
// `projects/<project>/instances/<instance>/databases/<database>`. // `projects/<project>/instances/<instance>/databases/<database>`.
@ -314,8 +298,8 @@ message GetDatabaseRequest {
// Each batch of statements is assigned a name which can be used with // Each batch of statements is assigned a name which can be used with
// the [Operations][google.longrunning.Operations] API to monitor // the [Operations][google.longrunning.Operations] API to monitor
// progress. See the // progress. See the
// [operation_id][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.operation_id] // [operation_id][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.operation_id] field for more
// field for more details. // details.
message UpdateDatabaseDdlRequest { message UpdateDatabaseDdlRequest {
// Required. The database to update. // Required. The database to update.
string database = 1 [ string database = 1 [
@ -335,20 +319,18 @@ message UpdateDatabaseDdlRequest {
// //
// Specifying an explicit operation ID simplifies determining // Specifying an explicit operation ID simplifies determining
// whether the statements were executed in the event that the // whether the statements were executed in the event that the
// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] // [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] call is replayed,
// call is replayed, or the return value is otherwise lost: the // or the return value is otherwise lost: the [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database] and
// [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database] // `operation_id` fields can be combined to form the
// and `operation_id` fields can be combined to form the
// [name][google.longrunning.Operation.name] of the resulting // [name][google.longrunning.Operation.name] of the resulting
// [longrunning.Operation][google.longrunning.Operation]: // [longrunning.Operation][google.longrunning.Operation]: `<database>/operations/<operation_id>`.
// `<database>/operations/<operation_id>`.
// //
// `operation_id` should be unique within the database, and must be // `operation_id` should be unique within the database, and must be
// a valid identifier: `[a-z][a-z0-9_]*`. Note that // a valid identifier: `[a-z][a-z0-9_]*`. Note that
// automatically-generated operation IDs always begin with an // automatically-generated operation IDs always begin with an
// underscore. If the named operation already exists, // underscore. If the named operation already exists,
// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] // [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] returns
// returns `ALREADY_EXISTS`. // `ALREADY_EXISTS`.
string operation_id = 3; string operation_id = 3;
} }
@ -357,8 +339,8 @@ message UpdateDatabaseDdlRequest {
message UpdateDatabaseDdlMetadata { message UpdateDatabaseDdlMetadata {
// The database being modified. // The database being modified.
string database = 1 [(google.api.resource_reference) = { string database = 1 [(google.api.resource_reference) = {
type: "spanner.googleapis.com/Database" type: "spanner.googleapis.com/Database"
}]; }];
// For an update this list contains all the statements. For an // For an update this list contains all the statements. For an
// individual statement, this list contains only that statement. // individual statement, this list contains only that statement.
@ -370,8 +352,7 @@ message UpdateDatabaseDdlMetadata {
repeated google.protobuf.Timestamp commit_timestamps = 3; repeated google.protobuf.Timestamp commit_timestamps = 3;
} }
// The request for // The request for [DropDatabase][google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase].
// [DropDatabase][google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase].
message DropDatabaseRequest { message DropDatabaseRequest {
// Required. The database to be dropped. // Required. The database to be dropped.
string database = 1 [ string database = 1 [
@ -382,8 +363,7 @@ message DropDatabaseRequest {
]; ];
} }
// The request for // The request for [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
// [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
message GetDatabaseDdlRequest { message GetDatabaseDdlRequest {
// Required. The database whose schema we wish to get. // Required. The database whose schema we wish to get.
string database = 1 [ string database = 1 [
@ -394,8 +374,7 @@ message GetDatabaseDdlRequest {
]; ];
} }
// The response for // The response for [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
// [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
message GetDatabaseDdlResponse { message GetDatabaseDdlResponse {
// A list of formatted DDL statements defining the schema of the database // A list of formatted DDL statements defining the schema of the database
// specified in the request. // specified in the request.

@ -1,4 +1,4 @@
// Copyright 2019 Google LLC. // Copyright 2020 Google LLC
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//
syntax = "proto3"; syntax = "proto3";
@ -353,8 +352,8 @@ message Instance {
// also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and // also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. // [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
string config = 2 [(google.api.resource_reference) = { string config = 2 [(google.api.resource_reference) = {
type: "spanner.googleapis.com/InstanceConfig" type: "spanner.googleapis.com/InstanceConfig"
}]; }];
// Required. The descriptive name for this instance as it appears in UIs. // 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. // Must be unique per project and between 4 and 30 characters in length.
@ -459,9 +458,9 @@ message GetInstanceRequest {
} }
]; ];
// If field_mask is present, specifies the subset of [][Instance] fields that // If field_mask is present, specifies the subset of [Instance][google.spanner.admin.instance.v1.Instance] fields that
// should be returned. // should be returned.
// If absent, all [][Instance] fields are returned. // If absent, all [Instance][google.spanner.admin.instance.v1.Instance] fields are returned.
google.protobuf.FieldMask field_mask = 2; google.protobuf.FieldMask field_mask = 2;
} }
@ -542,12 +541,12 @@ message ListInstancesResponse {
// The request for [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]. // The request for [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance].
message UpdateInstanceRequest { message UpdateInstanceRequest {
// Required. The instance to update, which must always include the instance // Required. The instance to update, which must always include the instance
// name. Otherwise, only fields mentioned in [][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] need be included. // name. Otherwise, only fields mentioned in [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] need be included.
Instance instance = 1 [(google.api.field_behavior) = REQUIRED]; Instance instance = 1 [(google.api.field_behavior) = REQUIRED];
// Required. A mask specifying which fields in [][google.spanner.admin.instance.v1.UpdateInstanceRequest.instance] should be updated. // Required. A mask specifying which fields in [Instance][google.spanner.admin.instance.v1.Instance] should be updated.
// The field mask must always be specified; this prevents any future fields in // The field mask must always be specified; this prevents any future fields in
// [][google.spanner.admin.instance.v1.Instance] from being erased accidentally by clients that do not know // [Instance][google.spanner.admin.instance.v1.Instance] from being erased accidentally by clients that do not know
// about them. // about them.
google.protobuf.FieldMask field_mask = 2 [(google.api.field_behavior) = REQUIRED]; google.protobuf.FieldMask field_mask = 2 [(google.api.field_behavior) = REQUIRED];
} }

@ -1,4 +1,4 @@
// Copyright 2019 Google LLC. // Copyright 2020 Google LLC
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//
syntax = "proto3"; syntax = "proto3";

@ -1,4 +1,4 @@
// Copyright 2019 Google LLC. // Copyright 2020 Google LLC
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//
syntax = "proto3"; syntax = "proto3";
@ -61,7 +60,10 @@ message Mutation {
// Required. The table whose rows will be deleted. // Required. The table whose rows will be deleted.
string table = 1; string table = 1;
// Required. The primary keys of the rows within [table][google.spanner.v1.Mutation.Delete.table] to delete. // Required. The primary keys of the rows within [table][google.spanner.v1.Mutation.Delete.table] to delete. The
// primary keys must be specified in the order in which they appear in the
// `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL
// statement used to create the table).
// Delete is idempotent. The transaction will succeed even if some or all // Delete is idempotent. The transaction will succeed even if some or all
// rows do not exist. // rows do not exist.
KeySet key_set = 2; KeySet key_set = 2;
@ -80,6 +82,10 @@ message Mutation {
// Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, then // Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, then
// its column values are overwritten with the ones provided. Any // its column values are overwritten with the ones provided. Any
// column values not explicitly written are preserved. // column values not explicitly written are preserved.
//
// When using [insert_or_update][google.spanner.v1.Mutation.insert_or_update], just as when using [insert][google.spanner.v1.Mutation.insert], all `NOT
// NULL` columns in the table must be given a value. This holds true
// even when the row already exists and will therefore actually be updated.
Write insert_or_update = 3; Write insert_or_update = 3;
// Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, it is // Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, it is

@ -1,4 +1,4 @@
// Copyright 2019 Google LLC. // Copyright 2020 Google LLC
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//
syntax = "proto3"; syntax = "proto3";

@ -1,4 +1,4 @@
// Copyright 2019 Google LLC. // Copyright 2020 Google LLC
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//
syntax = "proto3"; syntax = "proto3";

@ -1,4 +1,4 @@
// Copyright 2019 Google LLC. // Copyright 2020 Google LLC
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//
syntax = "proto3"; syntax = "proto3";
@ -37,10 +36,6 @@ option java_multiple_files = true;
option java_outer_classname = "SpannerProto"; option java_outer_classname = "SpannerProto";
option java_package = "com.google.spanner.v1"; option java_package = "com.google.spanner.v1";
option php_namespace = "Google\\Cloud\\Spanner\\V1"; option php_namespace = "Google\\Cloud\\Spanner\\V1";
// The Database resource is defined in `google.spanner.admin.database.v1`.
// Because this is a separate, independent API (technically), we redefine
// the resource name pattern here.
option (google.api.resource_definition) = { option (google.api.resource_definition) = {
type: "spanner.googleapis.com/Database" type: "spanner.googleapis.com/Database"
pattern: "projects/{project}/instances/{instance}/databases/{database}" pattern: "projects/{project}/instances/{instance}/databases/{database}"
@ -69,7 +64,7 @@ service Spanner {
// //
// Active sessions use additional server resources, so it is a good idea to // Active sessions use additional server resources, so it is a good idea to
// delete idle and unneeded sessions. // delete idle and unneeded sessions.
// Aside from explicit deletes, Cloud Spanner can delete sessions for which no // Aside from explicit deletes, Cloud Spanner may delete sessions for which no
// operations are sent for more than an hour. If a session is deleted, // operations are sent for more than an hour. If a session is deleted,
// requests to it return `NOT_FOUND`. // requests to it return `NOT_FOUND`.
// //
@ -87,8 +82,7 @@ service Spanner {
// //
// This API can be used to initialize a session cache on the clients. // 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. // See https://goo.gl/TgSFN2 for best practices on session cache management.
rpc BatchCreateSessions(BatchCreateSessionsRequest) rpc BatchCreateSessions(BatchCreateSessionsRequest) returns (BatchCreateSessionsResponse) {
returns (BatchCreateSessionsResponse) {
option (google.api.http) = { option (google.api.http) = {
post: "/v1/{database=projects/*/instances/*/databases/*}/sessions:batchCreate" post: "/v1/{database=projects/*/instances/*/databases/*}/sessions:batchCreate"
body: "*" body: "*"
@ -131,12 +125,10 @@ service Spanner {
// //
// Operations inside read-write transactions might return `ABORTED`. If // Operations inside read-write transactions might return `ABORTED`. If
// this occurs, the application should restart the transaction from // this occurs, the application should restart the transaction from
// the beginning. See [Transaction][google.spanner.v1.Transaction] for more // the beginning. See [Transaction][google.spanner.v1.Transaction] for more details.
// details.
// //
// Larger result sets can be fetched in streaming fashion by calling // Larger result sets can be fetched in streaming fashion by calling
// [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] // [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] instead.
// instead.
rpc ExecuteSql(ExecuteSqlRequest) returns (ResultSet) { rpc ExecuteSql(ExecuteSqlRequest) returns (ResultSet) {
option (google.api.http) = { option (google.api.http) = {
post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeSql" post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeSql"
@ -144,11 +136,11 @@ service Spanner {
}; };
} }
// Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the // Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the result
// result set as a stream. Unlike // set as a stream. Unlike [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there
// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there is no limit on // is no limit on the size of the returned result set. However, no
// the size of the returned result set. However, no individual row in the // individual row in the result set can exceed 100 MiB, and no
// result set can exceed 100 MiB, and no column value can exceed 10 MiB. // column value can exceed 10 MiB.
rpc ExecuteStreamingSql(ExecuteSqlRequest) returns (stream PartialResultSet) { rpc ExecuteStreamingSql(ExecuteSqlRequest) returns (stream PartialResultSet) {
option (google.api.http) = { option (google.api.http) = {
post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeStreamingSql" post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeStreamingSql"
@ -161,15 +153,13 @@ service Spanner {
// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. // [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
// //
// Statements are executed in sequential order. A request can succeed even if // Statements are executed in sequential order. A request can succeed even if
// a statement fails. The // a statement fails. The [ExecuteBatchDmlResponse.status][google.spanner.v1.ExecuteBatchDmlResponse.status] field in the
// [ExecuteBatchDmlResponse.status][google.spanner.v1.ExecuteBatchDmlResponse.status] // response provides information about the statement that failed. Clients must
// field in the response provides information about the statement that failed. // inspect this field to determine whether an error occurred.
// Clients must inspect this field to determine whether an error occurred.
// //
// Execution stops after the first failed statement; the remaining statements // Execution stops after the first failed statement; the remaining statements
// are not executed. // are not executed.
rpc ExecuteBatchDml(ExecuteBatchDmlRequest) rpc ExecuteBatchDml(ExecuteBatchDmlRequest) returns (ExecuteBatchDmlResponse) {
returns (ExecuteBatchDmlResponse) {
option (google.api.http) = { option (google.api.http) = {
post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeBatchDml" post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeBatchDml"
body: "*" body: "*"
@ -178,15 +168,14 @@ service Spanner {
// Reads rows from the database using key lookups and scans, as a // Reads rows from the database using key lookups and scans, as a
// simple key/value style alternative to // simple key/value style alternative to
// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be // [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be used to
// used to return a result set larger than 10 MiB; if the read matches more // return a result set larger than 10 MiB; if the read matches more
// data than that, the read fails with a `FAILED_PRECONDITION` // data than that, the read fails with a `FAILED_PRECONDITION`
// error. // error.
// //
// Reads inside read-write transactions might return `ABORTED`. If // Reads inside read-write transactions might return `ABORTED`. If
// this occurs, the application should restart the transaction from // this occurs, the application should restart the transaction from
// the beginning. See [Transaction][google.spanner.v1.Transaction] for more // the beginning. See [Transaction][google.spanner.v1.Transaction] for more details.
// details.
// //
// Larger result sets can be yielded in streaming fashion by calling // Larger result sets can be yielded in streaming fashion by calling
// [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead. // [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead.
@ -197,9 +186,9 @@ service Spanner {
}; };
} }
// Like [Read][google.spanner.v1.Spanner.Read], except returns the result set // Like [Read][google.spanner.v1.Spanner.Read], except returns the result set as a
// as a stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no // stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no limit on the
// limit on the size of the returned result set. However, no individual row in // size of the returned result set. However, no individual row in
// the result set can exceed 100 MiB, and no column value can exceed // the result set can exceed 100 MiB, and no column value can exceed
// 10 MiB. // 10 MiB.
rpc StreamingRead(ReadRequest) returns (stream PartialResultSet) { rpc StreamingRead(ReadRequest) returns (stream PartialResultSet) {
@ -210,8 +199,7 @@ service Spanner {
} }
// Begins a new transaction. This step can often be skipped: // Begins a new transaction. This step can often be skipped:
// [Read][google.spanner.v1.Spanner.Read], // [Read][google.spanner.v1.Spanner.Read], [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
// [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a // [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a
// side-effect. // side-effect.
rpc BeginTransaction(BeginTransactionRequest) returns (Transaction) { rpc BeginTransaction(BeginTransactionRequest) returns (Transaction) {
@ -236,15 +224,13 @@ service Spanner {
body: "*" body: "*"
}; };
option (google.api.method_signature) = "session,transaction_id,mutations"; option (google.api.method_signature) = "session,transaction_id,mutations";
option (google.api.method_signature) = option (google.api.method_signature) = "session,single_use_transaction,mutations";
"session,single_use_transaction,mutations";
} }
// Rolls back a transaction, releasing any locks it holds. It is a good // 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 // idea to call this for any transaction that includes one or more
// [Read][google.spanner.v1.Spanner.Read] or // [Read][google.spanner.v1.Spanner.Read] or [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and
// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and ultimately // ultimately decides not to commit.
// decides not to commit.
// //
// `Rollback` returns `OK` if it successfully aborts the transaction, the // `Rollback` returns `OK` if it successfully aborts the transaction, the
// transaction was already aborted, or the transaction is not // transaction was already aborted, or the transaction is not
@ -259,11 +245,10 @@ service Spanner {
// Creates a set of partition tokens that can be used to execute a query // 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 // operation in parallel. Each of the returned partition tokens can be used
// by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to // by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to specify a subset
// specify a subset of the query result to read. The same session and // of the query result to read. The same session and read-only transaction
// read-only transaction must be used by the PartitionQueryRequest used to // must be used by the PartitionQueryRequest used to create the
// create the partition tokens and the ExecuteSqlRequests that use the // partition tokens and the ExecuteSqlRequests that use the partition tokens.
// partition tokens.
// //
// Partition tokens become invalid when the session used to create them // 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 // is deleted, is idle for too long, begins a new transaction, or becomes too
@ -278,13 +263,12 @@ service Spanner {
// Creates a set of partition tokens that can be used to execute a read // 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 // operation in parallel. Each of the returned partition tokens can be used
// by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a // by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a subset of the read
// subset of the read result to read. The same session and read-only // result to read. The same session and read-only transaction must be used by
// transaction must be used by the PartitionReadRequest used to create the // the PartitionReadRequest used to create the partition tokens and the
// partition tokens and the ReadRequests that use the partition tokens. There // ReadRequests that use the partition tokens. There are no ordering
// are no ordering guarantees on rows returned among the returned partition // guarantees on rows returned among the returned partition tokens, or even
// tokens, or even within each individual StreamingRead call issued with a // within each individual StreamingRead call issued with a partition_token.
// partition_token.
// //
// Partition tokens become invalid when the session used to create them // 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 // is deleted, is idle for too long, begins a new transaction, or becomes too
@ -312,8 +296,7 @@ message CreateSessionRequest {
Session session = 2; Session session = 2;
} }
// The request for // The request for [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
// [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
message BatchCreateSessionsRequest { message BatchCreateSessionsRequest {
// Required. The database in which the new sessions are created. // Required. The database in which the new sessions are created.
string database = 1 [ string database = 1 [
@ -330,13 +313,11 @@ message BatchCreateSessionsRequest {
// The API may return fewer than the requested number of sessions. If a // The API may return fewer than the requested number of sessions. If a
// specific number of sessions are desired, the client can make additional // specific number of sessions are desired, the client can make additional
// calls to BatchCreateSessions (adjusting // calls to BatchCreateSessions (adjusting
// [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] // [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] as necessary).
// as necessary).
int32 session_count = 3 [(google.api.field_behavior) = REQUIRED]; int32 session_count = 3 [(google.api.field_behavior) = REQUIRED];
} }
// The response for // The response for [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
// [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
message BatchCreateSessionsResponse { message BatchCreateSessionsResponse {
// The freshly created sessions. // The freshly created sessions.
repeated Session session = 1; repeated Session session = 1;
@ -377,7 +358,9 @@ message GetSessionRequest {
// Required. The name of the session to retrieve. // Required. The name of the session to retrieve.
string name = 1 [ string name = 1 [
(google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } (google.api.resource_reference) = {
type: "spanner.googleapis.com/Session"
}
]; ];
} }
@ -396,8 +379,7 @@ message ListSessionsRequest {
int32 page_size = 2; int32 page_size = 2;
// If non-empty, `page_token` should contain a // If non-empty, `page_token` should contain a
// [next_page_token][google.spanner.v1.ListSessionsResponse.next_page_token] // [next_page_token][google.spanner.v1.ListSessionsResponse.next_page_token] from a previous
// from a previous
// [ListSessionsResponse][google.spanner.v1.ListSessionsResponse]. // [ListSessionsResponse][google.spanner.v1.ListSessionsResponse].
string page_token = 3; string page_token = 3;
@ -420,8 +402,8 @@ message ListSessionsResponse {
repeated Session sessions = 1; repeated Session sessions = 1;
// `next_page_token` can be sent in a subsequent // `next_page_token` can be sent in a subsequent
// [ListSessions][google.spanner.v1.Spanner.ListSessions] call to fetch more // [ListSessions][google.spanner.v1.Spanner.ListSessions] call to fetch more of the matching
// of the matching sessions. // sessions.
string next_page_token = 2; string next_page_token = 2;
} }
@ -430,13 +412,36 @@ message DeleteSessionRequest {
// Required. The name of the session to delete. // Required. The name of the session to delete.
string name = 1 [ string name = 1 [
(google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } (google.api.resource_reference) = {
type: "spanner.googleapis.com/Session"
}
]; ];
} }
// The request for [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and // The request for [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
// [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql]. // [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql].
message ExecuteSqlRequest { message ExecuteSqlRequest {
// Query optimizer configuration.
message QueryOptions {
// An option to control the selection of optimizer version.
//
// This parameter allows individual queries to pick different query
// optimizer versions.
//
// Specifying "latest" as a value instructs Cloud Spanner to use the
// latest supported query optimizer version. If not specified, Cloud Spanner
// uses optimizer version set at the database level options. Any other
// positive integer (from the list of supported optimizer versions)
// overrides the default optimizer version for query execution.
// The list of supported optimizer versions can be queried from
// SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS. Executing a SQL statement
// with an invalid optimizer version will fail with a syntax error
// (`INVALID_ARGUMENT`) status.
//
// The `optimizer_version` statement hint has precedence over this setting.
string optimizer_version = 1;
}
// Mode in which the statement must be processed. // Mode in which the statement must be processed.
enum QueryMode { enum QueryMode {
// The default mode. Only the statement results are returned. // The default mode. Only the statement results are returned.
@ -454,7 +459,9 @@ message ExecuteSqlRequest {
// Required. The session in which the SQL query should be performed. // Required. The session in which the SQL query should be performed.
string session = 1 [ string session = 1 [
(google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } (google.api.resource_reference) = {
type: "spanner.googleapis.com/Session"
}
]; ];
// The transaction to use. // The transaction to use.
@ -488,8 +495,7 @@ message ExecuteSqlRequest {
// It is not always possible for Cloud Spanner to infer the right SQL type // It is not always possible for Cloud Spanner to infer the right SQL type
// from a JSON value. For example, values of type `BYTES` and values // from a JSON value. For example, values of type `BYTES` and values
// of type `STRING` both appear in // of type `STRING` both appear in [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings.
// [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings.
// //
// In these cases, `param_types` can be used to specify the exact // In these cases, `param_types` can be used to specify the exact
// SQL type for some or all of the SQL statement parameters. See the // SQL type for some or all of the SQL statement parameters. See the
@ -499,18 +505,15 @@ message ExecuteSqlRequest {
// If this request is resuming a previously interrupted SQL statement // If this request is resuming a previously interrupted SQL statement
// execution, `resume_token` should be copied from the last // execution, `resume_token` should be copied from the last
// [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the // [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the interruption. Doing this
// interruption. Doing this enables the new SQL statement execution to resume // enables the new SQL statement execution to resume where the last one left
// where the last one left off. The rest of the request parameters must // off. The rest of the request parameters must exactly match the
// exactly match the request that yielded this token. // request that yielded this token.
bytes resume_token = 6; bytes resume_token = 6;
// Used to control the amount of debugging information returned in // Used to control the amount of debugging information returned in
// [ResultSetStats][google.spanner.v1.ResultSetStats]. If // [ResultSetStats][google.spanner.v1.ResultSetStats]. If [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only
// [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is // be set to [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL].
// set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only
// be set to
// [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL].
QueryMode query_mode = 7; QueryMode query_mode = 7;
// If present, results will be restricted to the specified partition // If present, results will be restricted to the specified partition
@ -530,6 +533,9 @@ message ExecuteSqlRequest {
// //
// Required for DML statements. Ignored for queries. // Required for DML statements. Ignored for queries.
int64 seqno = 9; int64 seqno = 9;
// Query optimizer configuration to use for the given query.
QueryOptions query_options = 10;
} }
// The request for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. // The request for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml].
@ -555,9 +561,7 @@ message ExecuteBatchDmlRequest {
// It is not always possible for Cloud Spanner to infer the right SQL type // It is not always possible for Cloud Spanner to infer the right SQL type
// from a JSON value. For example, values of type `BYTES` and values // from a JSON value. For example, values of type `BYTES` and values
// of type `STRING` both appear in // of type `STRING` both appear in [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as JSON strings.
// [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as
// JSON strings.
// //
// In these cases, `param_types` can be used to specify the exact // In these cases, `param_types` can be used to specify the exact
// SQL type for some or all of the SQL statement parameters. See the // SQL type for some or all of the SQL statement parameters. See the
@ -569,7 +573,9 @@ message ExecuteBatchDmlRequest {
// Required. The session in which the DML statements should be performed. // Required. The session in which the DML statements should be performed.
string session = 1 [ string session = 1 [
(google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } (google.api.resource_reference) = {
type: "spanner.googleapis.com/Session"
}
]; ];
// Required. The transaction to use. Must be a read-write transaction. // Required. The transaction to use. Must be a read-write transaction.
@ -579,17 +585,17 @@ message ExecuteBatchDmlRequest {
// transaction. // transaction.
TransactionSelector transaction = 2 [(google.api.field_behavior) = REQUIRED]; TransactionSelector transaction = 2 [(google.api.field_behavior) = REQUIRED];
// Required. The list of statements to execute in this batch. Statements are // Required. The list of statements to execute in this batch. Statements are executed
// executed serially, such that the effects of statement `i` are visible to // serially, such that the effects of statement `i` are visible to statement
// statement `i+1`. Each statement must be a DML statement. Execution stops at // `i+1`. Each statement must be a DML statement. Execution stops at the
// the first failed statement; the remaining statements are not executed. // first failed statement; the remaining statements are not executed.
// //
// Callers must provide at least one statement. // Callers must provide at least one statement.
repeated Statement statements = 3 [(google.api.field_behavior) = REQUIRED]; repeated Statement statements = 3 [(google.api.field_behavior) = REQUIRED];
// Required. A per-transaction sequence number used to identify this request. // Required. A per-transaction sequence number used to identify this request. This field
// This field makes each request idempotent such that if the request is // makes each request idempotent such that if the request is received multiple
// received multiple times, at most one will succeed. // times, at most one will succeed.
// //
// The sequence number must be monotonically increasing within the // The sequence number must be monotonically increasing within the
// transaction. If a request arrives for the first time with an out-of-order // transaction. If a request arrives for the first time with an out-of-order
@ -598,47 +604,38 @@ message ExecuteBatchDmlRequest {
int64 seqno = 4 [(google.api.field_behavior) = REQUIRED]; int64 seqno = 4 [(google.api.field_behavior) = REQUIRED];
} }
// The response for // The response for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list
// [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list // of [ResultSet][google.spanner.v1.ResultSet] messages, one for each DML statement that has successfully
// of [ResultSet][google.spanner.v1.ResultSet] messages, one for each DML // executed, in the same order as the statements in the request. If a statement
// statement that has successfully executed, in the same order as the statements // fails, the status in the response body identifies the cause of the failure.
// 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: // To check for DML statements that failed, use the following approach:
// //
// 1. Check the status in the response message. The // 1. Check the status in the response message. The [google.rpc.Code][google.rpc.Code] enum
// [google.rpc.Code][google.rpc.Code] enum
// value `OK` indicates that all statements were executed successfully. // value `OK` indicates that all statements were executed successfully.
// 2. If the status was not `OK`, check the number of result sets in the // 2. If the status was not `OK`, check the number of result sets in the
// response. If the response contains `N` // response. If the response contains `N` [ResultSet][google.spanner.v1.ResultSet] messages, then
// [ResultSet][google.spanner.v1.ResultSet] messages, then statement `N+1` in // statement `N+1` in the request failed.
// the request failed.
// //
// Example 1: // Example 1:
// //
// * Request: 5 DML statements, all executed successfully. // * Request: 5 DML statements, all executed successfully.
// * Response: 5 [ResultSet][google.spanner.v1.ResultSet] messages, with the // * Response: 5 [ResultSet][google.spanner.v1.ResultSet] messages, with the status `OK`.
// status `OK`.
// //
// Example 2: // Example 2:
// //
// * Request: 5 DML statements. The third statement has a syntax error. // * Request: 5 DML statements. The third statement has a syntax error.
// * Response: 2 [ResultSet][google.spanner.v1.ResultSet] messages, and a syntax // * Response: 2 [ResultSet][google.spanner.v1.ResultSet] messages, and a syntax error (`INVALID_ARGUMENT`)
// error (`INVALID_ARGUMENT`) // status. The number of [ResultSet][google.spanner.v1.ResultSet] messages indicates that the third
// status. The number of [ResultSet][google.spanner.v1.ResultSet] messages // statement failed, and the fourth and fifth statements were not executed.
// indicates that the third statement failed, and the fourth and fifth
// statements were not executed.
message ExecuteBatchDmlResponse { message ExecuteBatchDmlResponse {
// One [ResultSet][google.spanner.v1.ResultSet] for each statement in the // One [ResultSet][google.spanner.v1.ResultSet] for each statement in the request that ran successfully,
// request that ran successfully, in the same order as the statements in the // in the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] does
// request. Each [ResultSet][google.spanner.v1.ResultSet] does not contain any // not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] contain
// rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each // the number of rows modified by the statement.
// [ResultSet][google.spanner.v1.ResultSet] contain the number of rows //
// modified by the statement. // Only the first [ResultSet][google.spanner.v1.ResultSet] in the response contains valid
// // [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
// Only the first [ResultSet][google.spanner.v1.ResultSet] in the response
// contains valid [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
repeated ResultSet result_sets = 1; repeated ResultSet result_sets = 1;
// If all DML statements are executed successfully, the status is `OK`. // If all DML statements are executed successfully, the status is `OK`.
@ -673,23 +670,24 @@ message PartitionQueryRequest {
// Required. The session used to create the partitions. // Required. The session used to create the partitions.
string session = 1 [ string session = 1 [
(google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } (google.api.resource_reference) = {
type: "spanner.googleapis.com/Session"
}
]; ];
// Read only snapshot transactions are supported, read/write and single use // Read only snapshot transactions are supported, read/write and single use
// transactions are not. // transactions are not.
TransactionSelector transaction = 2; TransactionSelector transaction = 2;
// Required. The query request to generate partitions for. The request will // Required. The query request to generate partitions for. The request will fail if
// fail if the query is not root partitionable. The query plan of a root // the query is not root partitionable. The query plan of a root
// partitionable query has a single distributed union operator. A distributed // partitionable query has a single distributed union operator. A distributed
// union operator conceptually divides one or more tables into multiple // union operator conceptually divides one or more tables into multiple
// splits, remotely evaluates a subquery independently on each split, and // splits, remotely evaluates a subquery independently on each split, and
// then unions all results. // then unions all results.
// //
// This must not contain DML commands, such as INSERT, UPDATE, or // This must not contain DML commands, such as INSERT, UPDATE, or
// DELETE. Use // DELETE. Use [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a
// [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a
// PartitionedDml transaction for large, partition-friendly DML operations. // PartitionedDml transaction for large, partition-friendly DML operations.
string sql = 3 [(google.api.field_behavior) = REQUIRED]; string sql = 3 [(google.api.field_behavior) = REQUIRED];
@ -709,8 +707,7 @@ message PartitionQueryRequest {
// It is not always possible for Cloud Spanner to infer the right SQL type // It is not always possible for Cloud Spanner to infer the right SQL type
// from a JSON value. For example, values of type `BYTES` and values // from a JSON value. For example, values of type `BYTES` and values
// of type `STRING` both appear in // of type `STRING` both appear in [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings.
// [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings.
// //
// In these cases, `param_types` can be used to specify the exact // In these cases, `param_types` can be used to specify the exact
// SQL type for some or all of the SQL query parameters. See the // SQL type for some or all of the SQL query parameters. See the
@ -727,7 +724,9 @@ message PartitionReadRequest {
// Required. The session used to create the partitions. // Required. The session used to create the partitions.
string session = 1 [ string session = 1 [
(google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } (google.api.resource_reference) = {
type: "spanner.googleapis.com/Session"
}
]; ];
// Read only snapshot transactions are supported, read/write and single use // Read only snapshot transactions are supported, read/write and single use
@ -737,24 +736,18 @@ message PartitionReadRequest {
// Required. The name of the table in the database to be read. // Required. The name of the table in the database to be read.
string table = 3 [(google.api.field_behavior) = REQUIRED]; string table = 3 [(google.api.field_behavior) = REQUIRED];
// If non-empty, the name of an index on // If non-empty, the name of an index on [table][google.spanner.v1.PartitionReadRequest.table]. This index is
// [table][google.spanner.v1.PartitionReadRequest.table]. This index is used // used instead of the table primary key when interpreting [key_set][google.spanner.v1.PartitionReadRequest.key_set]
// instead of the table primary key when interpreting // and sorting result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set] for further information.
// [key_set][google.spanner.v1.PartitionReadRequest.key_set] and sorting
// result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set]
// for further information.
string index = 4; string index = 4;
// The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be // The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be returned for each row matching
// returned for each row matching this request. // this request.
repeated string columns = 5; repeated string columns = 5;
// Required. `key_set` identifies the rows to be yielded. `key_set` names the // Required. `key_set` identifies the rows to be yielded. `key_set` names the
// primary keys of the rows in // primary keys of the rows in [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless [index][google.spanner.v1.PartitionReadRequest.index]
// [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless // is present. If [index][google.spanner.v1.PartitionReadRequest.index] is present, then [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names
// [index][google.spanner.v1.PartitionReadRequest.index] is present. If
// [index][google.spanner.v1.PartitionReadRequest.index] is present, then
// [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names
// index keys in [index][google.spanner.v1.PartitionReadRequest.index]. // index keys in [index][google.spanner.v1.PartitionReadRequest.index].
// //
// It is not an error for the `key_set` to name rows that do not // It is not an error for the `key_set` to name rows that do not
@ -790,7 +783,9 @@ message ReadRequest {
// Required. The session in which the read should be performed. // Required. The session in which the read should be performed.
string session = 1 [ string session = 1 [
(google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } (google.api.resource_reference) = {
type: "spanner.googleapis.com/Session"
}
]; ];
// The transaction to use. If none is provided, the default is a // The transaction to use. If none is provided, the default is a
@ -800,31 +795,24 @@ message ReadRequest {
// Required. The name of the table in the database to be read. // Required. The name of the table in the database to be read.
string table = 3 [(google.api.field_behavior) = REQUIRED]; string table = 3 [(google.api.field_behavior) = REQUIRED];
// If non-empty, the name of an index on // If non-empty, the name of an index on [table][google.spanner.v1.ReadRequest.table]. This index is
// [table][google.spanner.v1.ReadRequest.table]. This index is used instead of // used instead of the table primary key when interpreting [key_set][google.spanner.v1.ReadRequest.key_set]
// the table primary key when interpreting // and sorting result rows. See [key_set][google.spanner.v1.ReadRequest.key_set] for further information.
// [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows.
// See [key_set][google.spanner.v1.ReadRequest.key_set] for further
// information.
string index = 4; string index = 4;
// Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be // Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be returned for each row matching
// returned for each row matching this request. // this request.
repeated string columns = 5 [(google.api.field_behavior) = REQUIRED]; repeated string columns = 5 [(google.api.field_behavior) = REQUIRED];
// Required. `key_set` identifies the rows to be yielded. `key_set` names the // Required. `key_set` identifies the rows to be yielded. `key_set` names the
// primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to // primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to be yielded, unless [index][google.spanner.v1.ReadRequest.index]
// be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. // is present. If [index][google.spanner.v1.ReadRequest.index] is present, then [key_set][google.spanner.v1.ReadRequest.key_set] instead names
// If [index][google.spanner.v1.ReadRequest.index] is present, then // index keys in [index][google.spanner.v1.ReadRequest.index].
// [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys //
// in [index][google.spanner.v1.ReadRequest.index]. // If the [partition_token][google.spanner.v1.ReadRequest.partition_token] field is empty, rows are yielded
// // in table primary key order (if [index][google.spanner.v1.ReadRequest.index] is empty) or index key order
// If the [partition_token][google.spanner.v1.ReadRequest.partition_token] // (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the [partition_token][google.spanner.v1.ReadRequest.partition_token] field is not
// field is empty, rows are yielded in table primary key order (if // empty, rows will be yielded in an unspecified order.
// [index][google.spanner.v1.ReadRequest.index] is empty) or index key order
// (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the
// [partition_token][google.spanner.v1.ReadRequest.partition_token] field is
// not empty, rows will be yielded in an unspecified order.
// //
// It is not an error for the `key_set` to name rows that do not // It is not an error for the `key_set` to name rows that do not
// exist in the database. Read yields nothing for nonexistent rows. // exist in the database. Read yields nothing for nonexistent rows.
@ -837,9 +825,9 @@ message ReadRequest {
// If this request is resuming a previously interrupted read, // If this request is resuming a previously interrupted read,
// `resume_token` should be copied from the last // `resume_token` should be copied from the last
// [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the // [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the interruption. Doing this
// interruption. Doing this enables the new read to resume where the last read // enables the new read to resume where the last read left off. The
// left off. The rest of the request parameters must exactly match the request // rest of the request parameters must exactly match the request
// that yielded this token. // that yielded this token.
bytes resume_token = 9; bytes resume_token = 9;
@ -850,13 +838,14 @@ message ReadRequest {
bytes partition_token = 10; bytes partition_token = 10;
} }
// The request for // The request for [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction].
// [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction].
message BeginTransactionRequest { message BeginTransactionRequest {
// Required. The session in which the transaction runs. // Required. The session in which the transaction runs.
string session = 1 [ string session = 1 [
(google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } (google.api.resource_reference) = {
type: "spanner.googleapis.com/Session"
}
]; ];
// Required. Options for the new transaction. // Required. Options for the new transaction.
@ -868,7 +857,9 @@ message CommitRequest {
// Required. The session in which the transaction to be committed is running. // Required. The session in which the transaction to be committed is running.
string session = 1 [ string session = 1 [
(google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } (google.api.resource_reference) = {
type: "spanner.googleapis.com/Session"
}
]; ];
// Required. The transaction in which to commit. // Required. The transaction in which to commit.
@ -905,7 +896,9 @@ message RollbackRequest {
// Required. The session in which the transaction to roll back is running. // Required. The session in which the transaction to roll back is running.
string session = 1 [ string session = 1 [
(google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } (google.api.resource_reference) = {
type: "spanner.googleapis.com/Session"
}
]; ];
// Required. The transaction to roll back. // Required. The transaction to roll back.

@ -1,4 +1,4 @@
// Copyright 2019 Google LLC. // Copyright 2020 Google LLC
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//
syntax = "proto3"; syntax = "proto3";

@ -1,4 +1,4 @@
// Copyright 2019 Google LLC. // Copyright 2020 Google LLC
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//
syntax = "proto3"; syntax = "proto3";

Loading…
Cancel
Save