Skip to content

Commit b0c104f

Browse files
Google APIscopybara-github
authored andcommitted
feat: add database dialect
PiperOrigin-RevId: 423930262
1 parent c09a336 commit b0c104f

11 files changed

Lines changed: 131 additions & 87 deletions

File tree

google/spanner/admin/database/v1/backup.proto

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ syntax = "proto3";
1616

1717
package google.spanner.admin.database.v1;
1818

19+
import "google/api/annotations.proto";
1920
import "google/api/field_behavior.proto";
2021
import "google/api/resource.proto";
2122
import "google/longrunning/operations.proto";
2223
import "google/protobuf/field_mask.proto";
2324
import "google/protobuf/timestamp.proto";
2425
import "google/spanner/admin/database/v1/common.proto";
25-
import "google/api/annotations.proto";
2626

2727
option csharp_namespace = "Google.Cloud.Spanner.Admin.Database.V1";
2828
option go_package = "google.golang.org/genproto/googleapis/spanner/admin/database/v1;database";
@@ -117,6 +117,9 @@ message Backup {
117117

118118
// Output only. The encryption information for the backup.
119119
EncryptionInfo encryption_info = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
120+
121+
// Output only. The database dialect information for the backup.
122+
DatabaseDialect database_dialect = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
120123
}
121124

122125
// The request for [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup].

google/spanner/admin/database/v1/common.proto

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ syntax = "proto3";
1616

1717
package google.spanner.admin.database.v1;
1818

19+
import "google/api/annotations.proto";
1920
import "google/api/field_behavior.proto";
2021
import "google/api/resource.proto";
2122
import "google/protobuf/timestamp.proto";
2223
import "google/rpc/status.proto";
23-
import "google/api/annotations.proto";
2424

2525
option csharp_namespace = "Google.Cloud.Spanner.Admin.Database.V1";
2626
option go_package = "google.golang.org/genproto/googleapis/spanner/admin/database/v1;database";
@@ -98,3 +98,16 @@ message EncryptionInfo {
9898
}
9999
];
100100
}
101+
102+
// Indicates the dialect type of a database.
103+
enum DatabaseDialect {
104+
// Default value. This value will create a database with the
105+
// GOOGLE_STANDARD_SQL dialect.
106+
DATABASE_DIALECT_UNSPECIFIED = 0;
107+
108+
// Google standard SQL.
109+
GOOGLE_STANDARD_SQL = 1;
110+
111+
// PostgreSQL supported SQL.
112+
POSTGRESQL = 2;
113+
}

google/spanner/admin/database/v1/spanner_database_admin.proto

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import "google/iam/v1/iam_policy.proto";
2424
import "google/iam/v1/policy.proto";
2525
import "google/longrunning/operations.proto";
2626
import "google/protobuf/empty.proto";
27+
import "google/protobuf/field_mask.proto";
2728
import "google/protobuf/timestamp.proto";
2829
import "google/spanner/admin/database/v1/backup.proto";
2930
import "google/spanner/admin/database/v1/common.proto";
@@ -42,10 +43,11 @@ option (google.api.resource_definition) = {
4243

4344
// Cloud Spanner Database Admin API
4445
//
45-
// The Cloud Spanner Database Admin API can be used to create, drop, and
46-
// list databases. It also enables updating the schema of pre-existing
47-
// databases. It can be also used to create, delete and list backups for a
48-
// database and to restore from an existing backup.
46+
// The Cloud Spanner Database Admin API can be used to:
47+
// * create, drop, and list databases
48+
// * update the schema of pre-existing databases
49+
// * create, delete and list backups for a database
50+
// * restore a database from an existing backup
4951
service DatabaseAdmin {
5052
option (google.api.default_host) = "spanner.googleapis.com";
5153
option (google.api.oauth_scopes) =
@@ -110,6 +112,8 @@ service DatabaseAdmin {
110112
// Drops (aka deletes) a Cloud Spanner database.
111113
// Completed backups for the database will be retained according to their
112114
// `expire_time`.
115+
// Note: Cloud Spanner might continue to accept requests for a few seconds
116+
// after the database has been deleted.
113117
rpc DropDatabase(DropDatabaseRequest) returns (google.protobuf.Empty) {
114118
option (google.api.http) = {
115119
delete: "/v1/{database=projects/*/instances/*/databases/*}"
@@ -407,6 +411,9 @@ message Database {
407411
// database option set using DatabaseAdmin.CreateDatabase or
408412
// DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
409413
string default_leader = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
414+
415+
// Output only. The dialect of the Cloud Spanner Database.
416+
DatabaseDialect database_dialect = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
410417
}
411418

412419
// The request for [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
@@ -469,6 +476,9 @@ message CreateDatabaseRequest {
469476
// specified, Cloud Spanner will encrypt/decrypt all data at rest using
470477
// Google default encryption.
471478
EncryptionConfig encryption_config = 4 [(google.api.field_behavior) = OPTIONAL];
479+
480+
// Optional. The dialect of the Cloud Spanner Database.
481+
DatabaseDialect database_dialect = 5 [(google.api.field_behavior) = OPTIONAL];
472482
}
473483

474484
// Metadata type for the operation returned by

google/spanner/v1/commit_response.proto

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ syntax = "proto3";
1616

1717
package google.spanner.v1;
1818

19+
import "google/api/annotations.proto";
1920
import "google/protobuf/duration.proto";
2021
import "google/protobuf/timestamp.proto";
21-
import "google/api/annotations.proto";
2222

2323
option csharp_namespace = "Google.Cloud.Spanner.V1";
2424
option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner";
@@ -36,9 +36,9 @@ message CommitResponse {
3636
// `mutation_count` value can help you maximize the number of mutations
3737
// in a transaction and minimize the number of API round trips. You can
3838
// also monitor this value to prevent transactions from exceeding the system
39-
// [limit](http://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data).
39+
// [limit](https://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data).
4040
// If the number of mutations exceeds the limit, the server returns
41-
// [INVALID_ARGUMENT](http://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT).
41+
// [INVALID_ARGUMENT](https://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT).
4242
int64 mutation_count = 1;
4343
}
4444

google/spanner/v1/keys.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ syntax = "proto3";
1616

1717
package google.spanner.v1;
1818

19-
import "google/protobuf/struct.proto";
2019
import "google/api/annotations.proto";
20+
import "google/protobuf/struct.proto";
2121

2222
option csharp_namespace = "Google.Cloud.Spanner.V1";
2323
option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner";

google/spanner/v1/mutation.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Google LLC
1+
// Copyright 2021 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -16,9 +16,9 @@ syntax = "proto3";
1616

1717
package google.spanner.v1;
1818

19+
import "google/api/annotations.proto";
1920
import "google/protobuf/struct.proto";
2021
import "google/spanner/v1/keys.proto";
21-
import "google/api/annotations.proto";
2222

2323
option csharp_namespace = "Google.Cloud.Spanner.V1";
2424
option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner";

google/spanner/v1/query_plan.proto

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ syntax = "proto3";
1616

1717
package google.spanner.v1;
1818

19-
import "google/protobuf/struct.proto";
2019
import "google/api/annotations.proto";
20+
import "google/protobuf/struct.proto";
2121

2222
option csharp_namespace = "Google.Cloud.Spanner.V1";
2323
option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner";
@@ -29,6 +29,24 @@ option ruby_package = "Google::Cloud::Spanner::V1";
2929

3030
// Node information for nodes appearing in a [QueryPlan.plan_nodes][google.spanner.v1.QueryPlan.plan_nodes].
3131
message PlanNode {
32+
// The kind of [PlanNode][google.spanner.v1.PlanNode]. Distinguishes between the two different kinds of
33+
// nodes that can appear in a query plan.
34+
enum Kind {
35+
// Not specified.
36+
KIND_UNSPECIFIED = 0;
37+
38+
// Denotes a Relational operator node in the expression tree. Relational
39+
// operators represent iterative processing of rows during query execution.
40+
// For example, a `TableScan` operation that reads rows from a table.
41+
RELATIONAL = 1;
42+
43+
// Denotes a Scalar node in the expression tree. Scalar nodes represent
44+
// non-iterable entities in the query plan. For example, constants or
45+
// arithmetic operators appearing inside predicate expressions or references
46+
// to column names.
47+
SCALAR = 2;
48+
}
49+
3250
// Metadata associated with a parent-child relationship appearing in a
3351
// [PlanNode][google.spanner.v1.PlanNode].
3452
message ChildLink {
@@ -66,24 +84,6 @@ message PlanNode {
6684
map<string, int32> subqueries = 2;
6785
}
6886

69-
// The kind of [PlanNode][google.spanner.v1.PlanNode]. Distinguishes between the two different kinds of
70-
// nodes that can appear in a query plan.
71-
enum Kind {
72-
// Not specified.
73-
KIND_UNSPECIFIED = 0;
74-
75-
// Denotes a Relational operator node in the expression tree. Relational
76-
// operators represent iterative processing of rows during query execution.
77-
// For example, a `TableScan` operation that reads rows from a table.
78-
RELATIONAL = 1;
79-
80-
// Denotes a Scalar node in the expression tree. Scalar nodes represent
81-
// non-iterable entities in the query plan. For example, constants or
82-
// arithmetic operators appearing inside predicate expressions or references
83-
// to column names.
84-
SCALAR = 2;
85-
}
86-
8787
// The `PlanNode`'s index in [node list][google.spanner.v1.QueryPlan.plan_nodes].
8888
int32 index = 1;
8989

google/spanner/v1/result_set.proto

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ syntax = "proto3";
1616

1717
package google.spanner.v1;
1818

19+
import "google/api/annotations.proto";
1920
import "google/protobuf/struct.proto";
21+
import "google/spanner/v1/commit_response.proto";
2022
import "google/spanner/v1/query_plan.proto";
2123
import "google/spanner/v1/transaction.proto";
2224
import "google/spanner/v1/type.proto";
23-
import "google/api/annotations.proto";
2425

2526
option cc_enable_arenas = true;
2627
option csharp_namespace = "Google.Cloud.Spanner.V1";

google/spanner/v1/spanner.proto

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ syntax = "proto3";
1616

1717
package google.spanner.v1;
1818

19-
import public "google/spanner/v1/commit_response.proto";
2019
import "google/api/annotations.proto";
2120
import "google/api/client.proto";
2221
import "google/api/field_behavior.proto";
@@ -25,6 +24,7 @@ import "google/protobuf/empty.proto";
2524
import "google/protobuf/struct.proto";
2625
import "google/protobuf/timestamp.proto";
2726
import "google/rpc/status.proto";
27+
import public "google/spanner/v1/commit_response.proto";
2828
import "google/spanner/v1/keys.proto";
2929
import "google/spanner/v1/mutation.proto";
3030
import "google/spanner/v1/result_set.proto";
@@ -469,24 +469,40 @@ message RequestOptions {
469469
// Legal characters for `request_tag` values are all printable characters
470470
// (ASCII 32 - 126) and the length of a request_tag is limited to 50
471471
// characters. Values that exceed this limit are truncated.
472+
// Any leading underscore (_) characters will be removed from the string.
472473
string request_tag = 2;
473474

474475
// A tag used for statistics collection about this transaction.
475476
// Both request_tag and transaction_tag can be specified for a read or query
476477
// that belongs to a transaction.
477478
// The value of transaction_tag should be the same for all requests belonging
478479
// to the same transaction.
479-
// If this request doesnt belong to any transaction, transaction_tag will be
480+
// If this request doesn't belong to any transaction, transaction_tag will be
480481
// ignored.
481482
// Legal characters for `transaction_tag` values are all printable characters
482483
// (ASCII 32 - 126) and the length of a transaction_tag is limited to 50
483484
// characters. Values that exceed this limit are truncated.
485+
// Any leading underscore (_) characters will be removed from the string.
484486
string transaction_tag = 3;
485487
}
486488

487489
// The request for [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
488490
// [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql].
489491
message ExecuteSqlRequest {
492+
// Mode in which the statement must be processed.
493+
enum QueryMode {
494+
// The default mode. Only the statement results are returned.
495+
NORMAL = 0;
496+
497+
// This mode returns only the query plan, without any results or
498+
// execution statistics information.
499+
PLAN = 1;
500+
501+
// This mode returns both the query plan and the execution statistics along
502+
// with the results.
503+
PROFILE = 2;
504+
}
505+
490506
// Query optimizer configuration.
491507
message QueryOptions {
492508
// An option to control the selection of optimizer version.
@@ -540,20 +556,6 @@ message ExecuteSqlRequest {
540556
string optimizer_statistics_package = 2;
541557
}
542558

543-
// Mode in which the statement must be processed.
544-
enum QueryMode {
545-
// The default mode. Only the statement results are returned.
546-
NORMAL = 0;
547-
548-
// This mode returns only the query plan, without any results or
549-
// execution statistics information.
550-
PLAN = 1;
551-
552-
// This mode returns both the query plan and the execution statistics along
553-
// with the results.
554-
PROFILE = 2;
555-
}
556-
557559
// Required. The session in which the SQL query should be performed.
558560
string session = 1 [
559561
(google.api.field_behavior) = REQUIRED,

0 commit comments

Comments
 (0)