Skip to content

Commit 9aa7cb8

Browse files
feat: add tagging request options
PiperOrigin-RevId: 365498709 Source-Author: Google APIs <[email protected]> Source-Date: Sun Mar 28 20:54:25 2021 -0700 Source-Repo: googleapis/googleapis Source-Sha: 6ce40ff8faf68226782f507ca6b2d497a77044de Source-Link: googleapis/googleapis@6ce40ff
1 parent cdd1933 commit 9aa7cb8

File tree

6 files changed

+63
-19
lines changed

6 files changed

+63
-19
lines changed

google/cloud/spanner_admin_database_v1/proto/spanner_database_admin.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ message RestoreDatabaseRequest {
736736
// to. If this field is not specified, the restored database will use the same
737737
// encryption configuration as the backup by default, namely
738738
// [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type]
739-
// = `USE_CONFIG_DEFAULT_OR_DATABASE_ENCRYPTION`.
739+
// = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
740740
RestoreDatabaseEncryptionConfig encryption_config = 4
741741
[(google.api.field_behavior) = OPTIONAL];
742742
}

google/cloud/spanner_admin_database_v1/types/spanner_database_admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ class RestoreDatabaseRequest(proto.Message):
540540
not specified, the restored database will use the same
541541
encryption configuration as the backup by default, namely
542542
[encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type]
543-
= ``USE_CONFIG_DEFAULT_OR_DATABASE_ENCRYPTION``.
543+
= ``USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION``.
544544
"""
545545

546546
parent = proto.Field(proto.STRING, number=1)

google/cloud/spanner_admin_instance_v1/proto/spanner_instance_admin.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.
@@ -373,7 +373,7 @@ message Instance {
373373
// either omitted or set to `CREATING`. For
374374
// [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance], the state must be
375375
// either omitted or set to `READY`.
376-
State state = 6;
376+
State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
377377

378378
// Cloud Labels are a flexible and lightweight mechanism for organizing cloud
379379
// resources into groups that reflect a customer's organizational needs and

google/cloud/spanner_v1/proto/spanner.proto

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,27 @@ message RequestOptions {
459459

460460
// Priority for the request.
461461
Priority priority = 1;
462+
463+
// A per-request tag which can be applied to queries or reads, used for
464+
// statistics collection.
465+
// Both request_tag and transaction_tag can be specified for a read or query
466+
// that belongs to a transaction.
467+
// This field is ignored for requests where it's not applicable (e.g.
468+
// CommitRequest).
469+
// `request_tag` must be a valid identifier of the form:
470+
// `[a-zA-Z][a-zA-Z0-9_\-]` between 2 and 64 characters in length
471+
string request_tag = 2;
472+
473+
// A tag used for statistics collection about this transaction.
474+
// Both request_tag and transaction_tag can be specified for a read or query
475+
// that belongs to a transaction.
476+
// The value of transaction_tag should be the same for all requests belonging
477+
// to the same transaction.
478+
// If this request doesn’t belong to any transaction, transaction_tag will be
479+
// ignored.
480+
// `transaction_tag` must be a valid identifier of the format:
481+
// `[a-zA-Z][a-zA-Z0-9_\-]{0,49}`
482+
string transaction_tag = 3;
462483
}
463484

464485
// The request for [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
@@ -490,15 +511,15 @@ message ExecuteSqlRequest {
490511
// The `optimizer_version` statement hint has precedence over this setting.
491512
string optimizer_version = 1;
492513

493-
// Query optimizer statistics package to use.
514+
// An option to control the selection of optimizer statistics package.
494515
//
495516
// This parameter allows individual queries to use a different query
496-
// optimizer statistics.
517+
// optimizer statistics package.
497518
//
498519
// Specifying `latest` as a value instructs Cloud Spanner to use the latest
499520
// generated statistics package. If not specified, Cloud Spanner uses
500-
// statistics package set at the database level options, or latest if
501-
// the database option is not set.
521+
// the statistics package set at the database level options, or the latest
522+
// package if the database option is not set.
502523
//
503524
// The statistics package requested by the query has to be exempt from
504525
// garbage collection. This can be achieved with the following DDL
@@ -509,10 +530,10 @@ message ExecuteSqlRequest {
509530
// ```
510531
//
511532
// The list of available statistics packages can be queried from
512-
// `SPANNER_SYS.OPTIMIZER_STATISTICS_PACKAGES`.
533+
// `INFORMATION_SCHEMA.SPANNER_STATISTICS`.
513534
//
514535
// Executing a SQL statement with an invalid optimizer statistics package
515-
// or with statistics package that allows garbage collection fails with
536+
// or with a statistics package that allows garbage collection fails with
516537
// an `INVALID_ARGUMENT` error.
517538
string optimizer_statistics_package = 2;
518539
}

google/cloud/spanner_v1/types/spanner.py

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,24 @@ class RequestOptions(proto.Message):
247247
Attributes:
248248
priority (google.cloud.spanner_v1.types.RequestOptions.Priority):
249249
Priority for the request.
250+
request_tag (str):
251+
A per-request tag which can be applied to queries or reads,
252+
used for statistics collection. Both request_tag and
253+
transaction_tag can be specified for a read or query that
254+
belongs to a transaction. This field is ignored for requests
255+
where it's not applicable (e.g. CommitRequest).
256+
``request_tag`` must be a valid identifier of the form:
257+
``[a-zA-Z][a-zA-Z0-9_\-]`` between 2 and 64 characters in
258+
length
259+
transaction_tag (str):
260+
A tag used for statistics collection about this transaction.
261+
Both request_tag and transaction_tag can be specified for a
262+
read or query that belongs to a transaction. The value of
263+
transaction_tag should be the same for all requests
264+
belonging to the same transaction. If this request doesn’t
265+
belong to any transaction, transaction_tag will be ignored.
266+
``transaction_tag`` must be a valid identifier of the
267+
format: ``[a-zA-Z][a-zA-Z0-9_\-]{0,49}``
250268
"""
251269

252270
class Priority(proto.Enum):
@@ -275,6 +293,10 @@ class Priority(proto.Enum):
275293

276294
priority = proto.Field(proto.ENUM, number=1, enum=Priority,)
277295

296+
request_tag = proto.Field(proto.STRING, number=2)
297+
298+
transaction_tag = proto.Field(proto.STRING, number=3)
299+
278300

279301
class ExecuteSqlRequest(proto.Message):
280302
r"""The request for [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]
@@ -411,16 +433,17 @@ class QueryOptions(proto.Message):
411433
The ``optimizer_version`` statement hint has precedence over
412434
this setting.
413435
optimizer_statistics_package (str):
414-
Query optimizer statistics package to use.
436+
An option to control the selection of optimizer statistics
437+
package.
415438
416439
This parameter allows individual queries to use a different
417-
query optimizer statistics.
440+
query optimizer statistics package.
418441
419442
Specifying ``latest`` as a value instructs Cloud Spanner to
420443
use the latest generated statistics package. If not
421-
specified, Cloud Spanner uses statistics package set at the
422-
database level options, or latest if the database option is
423-
not set.
444+
specified, Cloud Spanner uses the statistics package set at
445+
the database level options, or the latest package if the
446+
database option is not set.
424447
425448
The statistics package requested by the query has to be
426449
exempt from garbage collection. This can be achieved with
@@ -431,10 +454,10 @@ class QueryOptions(proto.Message):
431454
ALTER STATISTICS <package_name> SET OPTIONS (allow_gc=false)
432455
433456
The list of available statistics packages can be queried
434-
from ``SPANNER_SYS.OPTIMIZER_STATISTICS_PACKAGES``.
457+
from ``INFORMATION_SCHEMA.SPANNER_STATISTICS``.
435458
436459
Executing a SQL statement with an invalid optimizer
437-
statistics package or with statistics package that allows
460+
statistics package or with a statistics package that allows
438461
garbage collection fails with an ``INVALID_ARGUMENT`` error.
439462
"""
440463

synth.metadata

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"git": {
1212
"name": "googleapis",
1313
"remote": "https://github.com/googleapis/googleapis.git",
14-
"sha": "6598bb829c9e9a534be674649ffd1b4671a821f9",
15-
"internalRef": "364449524"
14+
"sha": "6ce40ff8faf68226782f507ca6b2d497a77044de",
15+
"internalRef": "365498709"
1616
}
1717
},
1818
{

0 commit comments

Comments
 (0)