Skip to content

Commit ff7c472

Browse files
feat: [google-cloud-bigquery-reservation] Add a new field replication_status to .google.cloud.bigquery.reservation.v1.Reservation to provide visibility into errors that could arise during Disaster Recovery(DR) replication (#13562)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: Add a new field `replication_status` to `.google.cloud.bigquery.reservation.v1.Reservation` to provide visibility into errors that could arise during Disaster Recovery(DR) replication feat: Add the CONTINUOUS Job type to `.google.cloud.bigquery.reservation.v1.Assignment.JobType` for continuous SQL jobs feat: Add a new field `enable_gemini_in_bigquery` to `.google.cloud.bigquery.reservation.v1.Assignment` that indicates if [Gemini in Bigquery](https://cloud.google.com/gemini/docs/bigquery/overview) features are enabled for the reservation assignment docs: Update the `google.api.field_behavior` for the `.google.cloud.bigquery.reservation.v1.Reservation.primary_location` and `.google.cloud.bigquery.reservation.v1.Reservation.original_primary_location` fields to clarify that they are `OUTPUT_ONLY` docs: Remove the section about `EDITION_UNSPECIFIED` in the comment for `slot_capacity` in `.google.cloud.bigquery.reservation.v1.Reservation` END_COMMIT_OVERRIDE PiperOrigin-RevId: 731341086 Source-Link: googleapis/googleapis@f62aabb Source-Link: googleapis/googleapis-gen@b97eaf5 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJpZ3F1ZXJ5LXJlc2VydmF0aW9uLy5Pd2xCb3QueWFtbCIsImgiOiJiOTdlYWY1MWRkMGU1NGUyOWUxNmM3Y2RiZGJiNmFmMGM3NDU1Y2JiIn0= --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 2b74b97 commit ff7c472

File tree

9 files changed

+227
-31
lines changed

9 files changed

+227
-31
lines changed

packages/google-cloud-bigquery-reservation/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ In order to use this library, you first need to go through the following steps:
2626
1. `Select or create a Cloud Platform project.`_
2727
2. `Enable billing for your project.`_
2828
3. `Enable the BigQuery Reservation.`_
29-
4. `Setup Authentication.`_
29+
4. `Set up Authentication.`_
3030

3131
.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
3232
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
3333
.. _Enable the BigQuery Reservation.: https://cloud.google.com/bigquery/docs/reference/reservations
34-
.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
34+
.. _Set up Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
3535

3636
Installation
3737
~~~~~~~~~~~~

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.16.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.16.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def _prep_wrapped_messages(self, client_info):
190190
),
191191
self.failover_reservation: gapic_v1.method.wrap_method(
192192
self.failover_reservation,
193-
default_timeout=None,
193+
default_timeout=300.0,
194194
client_info=client_info,
195195
),
196196
self.create_capacity_commitment: gapic_v1.method.wrap_method(

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/grpc_asyncio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ def _prep_wrapped_messages(self, client_info):
12041204
),
12051205
self.failover_reservation: self._wrap_method(
12061206
self.failover_reservation,
1207-
default_timeout=None,
1207+
default_timeout=300.0,
12081208
client_info=client_info,
12091209
),
12101210
self.create_capacity_commitment: self._wrap_method(

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation_v1/types/reservation.py

Lines changed: 90 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -106,22 +106,15 @@ class Reservation(proto.Message):
106106
runtime if ignore_idle_slots is set to false, or autoscaling
107107
is enabled.
108108
109-
If edition is EDITION_UNSPECIFIED and total slot_capacity of
110-
the reservation and its siblings exceeds the total
111-
slot_count of all capacity commitments, the request will
112-
fail with ``google.rpc.Code.RESOURCE_EXHAUSTED``.
113-
114-
If edition is any value but EDITION_UNSPECIFIED, then the
115-
above requirement is not needed. The total slot_capacity of
116-
the reservation and its siblings may exceed the total
117-
slot_count of capacity commitments. In that case, the
118-
exceeding slots will be charged with the autoscale SKU. You
119-
can increase the number of baseline slots in a reservation
120-
every few minutes. If you want to decrease your baseline
121-
slots, you are limited to once an hour if you have recently
122-
changed your baseline slot capacity and your baseline slots
123-
exceed your committed slots. Otherwise, you can decrease
124-
your baseline slots every few minutes.
109+
The total slot_capacity of the reservation and its siblings
110+
may exceed the total slot_count of capacity commitments. In
111+
that case, the exceeding slots will be charged with the
112+
autoscale SKU. You can increase the number of baseline slots
113+
in a reservation every few minutes. If you want to decrease
114+
your baseline slots, you are limited to once an hour if you
115+
have recently changed your baseline slot capacity and your
116+
baseline slots exceed your committed slots. Otherwise, you
117+
can decrease your baseline slots every few minutes.
125118
ignore_idle_slots (bool):
126119
If false, any query or pipeline job using this reservation
127120
will use idle slots from other reservations within the same
@@ -165,7 +158,7 @@ class Reservation(proto.Message):
165158
edition (google.cloud.bigquery_reservation_v1.types.Edition):
166159
Edition of the reservation.
167160
primary_location (str):
168-
Optional. The current location of the
161+
Output only. The current location of the
169162
reservation's primary replica. This field is
170163
only set for reservations using the managed
171164
disaster recovery feature.
@@ -179,11 +172,24 @@ class Reservation(proto.Message):
179172
convert a non-failover reservation to a failover
180173
reservation(or vice versa).
181174
original_primary_location (str):
182-
Optional. The location where the reservation
183-
was originally created. This is set only during
184-
the failover reservation's creation. All billing
185-
charges for the failover reservation will be
186-
applied to this location.
175+
Output only. The location where the
176+
reservation was originally created. This is set
177+
only during the failover reservation's creation.
178+
All billing charges for the failover reservation
179+
will be applied to this location.
180+
replication_status (google.cloud.bigquery_reservation_v1.types.Reservation.ReplicationStatus):
181+
Output only. The Disaster Recovery(DR)
182+
replication status of the reservation. This is
183+
only available for the primary replicas of
184+
DR/failover reservations and provides
185+
information about the both the staleness of the
186+
secondary and the last error encountered while
187+
trying to replicate changes from the primary to
188+
the secondary. If this field is blank, it means
189+
that the reservation is either not a DR
190+
reservation or the reservation is a DR secondary
191+
or that any replication operations on the
192+
reservation have succeeded.
187193
"""
188194

189195
class Autoscale(proto.Message):
@@ -210,6 +216,43 @@ class Autoscale(proto.Message):
210216
number=2,
211217
)
212218

219+
class ReplicationStatus(proto.Message):
220+
r"""Disaster Recovery(DR) replication status of the reservation.
221+
222+
Attributes:
223+
error (google.rpc.status_pb2.Status):
224+
Output only. The last error encountered while
225+
trying to replicate changes from the primary to
226+
the secondary. This field is only available if
227+
the replication has not succeeded since.
228+
last_error_time (google.protobuf.timestamp_pb2.Timestamp):
229+
Output only. The time at which the last error
230+
was encountered while trying to replicate
231+
changes from the primary to the secondary. This
232+
field is only available if the replication has
233+
not succeeded since.
234+
last_replication_time (google.protobuf.timestamp_pb2.Timestamp):
235+
Output only. A timestamp corresponding to the
236+
last change on the primary that was successfully
237+
replicated to the secondary.
238+
"""
239+
240+
error: status_pb2.Status = proto.Field(
241+
proto.MESSAGE,
242+
number=1,
243+
message=status_pb2.Status,
244+
)
245+
last_error_time: timestamp_pb2.Timestamp = proto.Field(
246+
proto.MESSAGE,
247+
number=2,
248+
message=timestamp_pb2.Timestamp,
249+
)
250+
last_replication_time: timestamp_pb2.Timestamp = proto.Field(
251+
proto.MESSAGE,
252+
number=3,
253+
message=timestamp_pb2.Timestamp,
254+
)
255+
213256
name: str = proto.Field(
214257
proto.STRING,
215258
number=1,
@@ -262,6 +305,11 @@ class Autoscale(proto.Message):
262305
proto.STRING,
263306
number=20,
264307
)
308+
replication_status: ReplicationStatus = proto.Field(
309+
proto.MESSAGE,
310+
number=24,
311+
message=ReplicationStatus,
312+
)
265313

266314

267315
class CapacityCommitment(proto.Message):
@@ -897,6 +945,16 @@ class Assignment(proto.Message):
897945
Which type of jobs will use the reservation.
898946
state (google.cloud.bigquery_reservation_v1.types.Assignment.State):
899947
Output only. State of the assignment.
948+
enable_gemini_in_bigquery (bool):
949+
Optional. This field controls if "Gemini in BigQuery"
950+
(https://cloud.google.com/gemini/docs/bigquery/overview)
951+
features should be enabled for this reservation assignment,
952+
which is not on by default. "Gemini in BigQuery" has a
953+
distinct compliance posture from BigQuery. If this field is
954+
set to true, the assignment job type is QUERY, and the
955+
parent reservation edition is ENTERPRISE_PLUS, then the
956+
assignment will give the grantee project/organization access
957+
to "Gemini in BigQuery" features.
900958
"""
901959

902960
class JobType(proto.Enum):
@@ -920,12 +978,18 @@ class JobType(proto.Enum):
920978
BACKGROUND (4):
921979
Background jobs that BigQuery runs for the
922980
customers in the background.
981+
CONTINUOUS (6):
982+
Continuous SQL jobs will use this
983+
reservation. Reservations with continuous
984+
assignments cannot be mixed with non-continuous
985+
assignments.
923986
"""
924987
JOB_TYPE_UNSPECIFIED = 0
925988
PIPELINE = 1
926989
QUERY = 2
927990
ML_EXTERNAL = 3
928991
BACKGROUND = 4
992+
CONTINUOUS = 6
929993

930994
class State(proto.Enum):
931995
r"""Assignment will remain in PENDING state if no active capacity
@@ -963,6 +1027,10 @@ class State(proto.Enum):
9631027
number=6,
9641028
enum=State,
9651029
)
1030+
enable_gemini_in_bigquery: bool = proto.Field(
1031+
proto.BOOL,
1032+
number=10,
1033+
)
9661034

9671035

9681036
class CreateAssignmentRequest(proto.Message):

packages/google-cloud-bigquery-reservation/noxfile.py

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,20 +382,29 @@ def docfx(session):
382382
["python", "upb", "cpp"],
383383
)
384384
def prerelease_deps(session, protobuf_implementation):
385-
"""Run all tests with prerelease versions of dependencies installed."""
385+
"""
386+
Run all tests with pre-release versions of dependencies installed
387+
rather than the standard non pre-release versions.
388+
Pre-releases versions can be installed using
389+
`pip install --pre <package>`.
390+
"""
386391

387392
if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"):
388393
session.skip("cpp implementation is not supported in python 3.11+")
389394

390395
# Install all dependencies
391-
session.install("-e", ".[all, tests, tracing]")
396+
session.install("-e", ".")
397+
392398
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
399+
# Install dependencies for the unit test environment
393400
session.install(*unit_deps_all)
401+
394402
system_deps_all = (
395403
SYSTEM_TEST_STANDARD_DEPENDENCIES
396404
+ SYSTEM_TEST_EXTERNAL_DEPENDENCIES
397405
+ SYSTEM_TEST_EXTRAS
398406
)
407+
# Install dependencies for the system test environment
399408
session.install(*system_deps_all)
400409

401410
# Because we test minimum dependency versions on the minimum Python
@@ -417,6 +426,7 @@ def prerelease_deps(session, protobuf_implementation):
417426
)
418427
]
419428

429+
# Install dependencies specified in `testing/constraints-X.txt`.
420430
session.install(*constraints_deps)
421431

422432
prerel_deps = [
@@ -458,3 +468,70 @@ def prerelease_deps(session, protobuf_implementation):
458468
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
459469
},
460470
)
471+
472+
473+
@nox.session(python="3.13")
474+
@nox.parametrize(
475+
"protobuf_implementation",
476+
["python", "upb"],
477+
)
478+
def core_deps_from_source(session, protobuf_implementation):
479+
"""Run all tests with local versions of core dependencies installed,
480+
rather than pulling core dependencies from PyPI.
481+
"""
482+
483+
# Install all dependencies
484+
session.install(".")
485+
486+
# Install dependencies for the unit test environment
487+
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
488+
session.install(*unit_deps_all)
489+
490+
# Install dependencies for the system test environment
491+
system_deps_all = (
492+
SYSTEM_TEST_STANDARD_DEPENDENCIES
493+
+ SYSTEM_TEST_EXTERNAL_DEPENDENCIES
494+
+ SYSTEM_TEST_EXTRAS
495+
)
496+
session.install(*system_deps_all)
497+
498+
# Because we test minimum dependency versions on the minimum Python
499+
# version, the first version we test with in the unit tests sessions has a
500+
# constraints file containing all dependencies and extras that should be installed.
501+
with open(
502+
CURRENT_DIRECTORY
503+
/ "testing"
504+
/ f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
505+
encoding="utf-8",
506+
) as constraints_file:
507+
constraints_text = constraints_file.read()
508+
509+
# Ignore leading whitespace and comment lines.
510+
constraints_deps = [
511+
match.group(1)
512+
for match in re.finditer(
513+
r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE
514+
)
515+
]
516+
517+
# Install dependencies specified in `testing/constraints-X.txt`.
518+
session.install(*constraints_deps)
519+
520+
core_dependencies_from_source = [
521+
"google-api-core @ git+https://github.com/googleapis/python-api-core.git",
522+
"google-auth @ git+https://github.com/googleapis/google-auth-library-python.git",
523+
f"{CURRENT_DIRECTORY}/../googleapis-common-protos",
524+
f"{CURRENT_DIRECTORY}/../grpc-google-iam-v1",
525+
"proto-plus @ git+https://github.com/googleapis/proto-plus-python.git",
526+
]
527+
528+
for dep in core_dependencies_from_source:
529+
session.install(dep, "--ignore-installed", "--no-deps")
530+
531+
session.run(
532+
"py.test",
533+
"tests/unit",
534+
env={
535+
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
536+
},
537+
)

packages/google-cloud-bigquery-reservation/samples/generated_samples/snippet_metadata_google.cloud.bigquery.reservation.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-bigquery-reservation",
11-
"version": "1.16.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

0 commit comments

Comments
 (0)