Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit 346c719

Browse files
fix(deps): require google-api-core >= 2.8.0 (#465)
* chore: use gapic-generator-python 1.1.1 PiperOrigin-RevId: 459095142 Source-Link: googleapis/googleapis@4f1be99 Source-Link: googleapis/googleapis-gen@ae686d9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWU2ODZkOWNkZTRmYzNlMzZkMGFjMDJlZmI4NjQzYjE1ODkwYzFlZCJ9 fix: Modify client lib retry policy for CreateWriteStream with longer backoff, more error code and longer overall time PiperOrigin-RevId: 457061436 Source-Link: googleapis/googleapis@8ff130b Source-Link: googleapis/googleapis-gen@2eb0fac Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmViMGZhY2E3MTdkOWNmNDRiODM4YjdkYjVlODYyNDUxYjhhODZlZiJ9 feat: add audience parameter PiperOrigin-RevId: 456827138 Source-Link: googleapis/googleapis@23f1a15 Source-Link: googleapis/googleapis-gen@4075a85 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDA3NWE4NTE0ZjY3NjY5MWVjMTU2Njg4YTViYmYxODNhYTk4OTNjZSJ9 feat: add fields to eventually contain row level errors Committer: @gnanda PiperOrigin-RevId: 456324780 Source-Link: googleapis/googleapis@f24b37a Source-Link: googleapis/googleapis-gen@33f9d81 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzNmOWQ4MTQwODIxMTcxMTZjNGI2OGE2ZjVhYWMzZjQyYmVjMzVjMiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix(deps): require google-api-core >= 2.8.0 * regenerate pb2 files using latest grpcio tools * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent c13b1e5 commit 346c719

32 files changed

Lines changed: 395 additions & 538 deletions

File tree

google/cloud/bigquery_storage/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
from google.cloud.bigquery_storage_v1.types.storage import GetWriteStreamRequest
4949
from google.cloud.bigquery_storage_v1.types.storage import ReadRowsRequest
5050
from google.cloud.bigquery_storage_v1.types.storage import ReadRowsResponse
51+
from google.cloud.bigquery_storage_v1.types.storage import RowError
5152
from google.cloud.bigquery_storage_v1.types.storage import SplitReadStreamRequest
5253
from google.cloud.bigquery_storage_v1.types.storage import SplitReadStreamResponse
5354
from google.cloud.bigquery_storage_v1.types.storage import StorageError
@@ -86,6 +87,7 @@
8687
"GetWriteStreamRequest",
8788
"ReadRowsRequest",
8889
"ReadRowsResponse",
90+
"RowError",
8991
"SplitReadStreamRequest",
9092
"SplitReadStreamResponse",
9193
"StorageError",

google/cloud/bigquery_storage_v1/services/big_query_read/async_client.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -288,20 +288,19 @@ async def sample_create_read_session():
288288
on the ``request`` instance; if ``request`` is provided, this
289289
should not be set.
290290
max_stream_count (:class:`int`):
291-
Max initial number of streams. If
292-
unset or zero, the server will provide a
293-
value of streams so as to produce
294-
reasonable throughput. Must be
295-
non-negative. The number of streams may
296-
be lower than the requested number,
297-
depending on the amount parallelism that
298-
is reasonable for the table. Error will
299-
be returned if the max count is greater
300-
than the current system max limit of
291+
Max initial number of streams. If unset or zero, the
292+
server will provide a value of streams so as to produce
293+
reasonable throughput. Must be non-negative. The number
294+
of streams may be lower than the requested number,
295+
depending on the amount parallelism that is reasonable
296+
for the table. There is a default system max limit of
301297
1,000.
302298
303-
Streams must be read starting from
304-
offset 0.
299+
This must be greater than or equal to
300+
preferred_min_stream_count. Typically, clients should
301+
either leave this unset to let the system to determine
302+
an upper bound OR set this a size for the maximum "units
303+
of work" it can gracefully handle.
305304
306305
This corresponds to the ``max_stream_count`` field
307306
on the ``request`` instance; if ``request`` is provided, this

google/cloud/bigquery_storage_v1/services/big_query_read/client.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ def __init__(
473473
quota_project_id=client_options.quota_project_id,
474474
client_info=client_info,
475475
always_use_jwt_access=True,
476+
api_audience=client_options.api_audience,
476477
)
477478

478479
def create_read_session(
@@ -546,20 +547,19 @@ def sample_create_read_session():
546547
on the ``request`` instance; if ``request`` is provided, this
547548
should not be set.
548549
max_stream_count (int):
549-
Max initial number of streams. If
550-
unset or zero, the server will provide a
551-
value of streams so as to produce
552-
reasonable throughput. Must be
553-
non-negative. The number of streams may
554-
be lower than the requested number,
555-
depending on the amount parallelism that
556-
is reasonable for the table. Error will
557-
be returned if the max count is greater
558-
than the current system max limit of
550+
Max initial number of streams. If unset or zero, the
551+
server will provide a value of streams so as to produce
552+
reasonable throughput. Must be non-negative. The number
553+
of streams may be lower than the requested number,
554+
depending on the amount parallelism that is reasonable
555+
for the table. There is a default system max limit of
559556
1,000.
560557
561-
Streams must be read starting from
562-
offset 0.
558+
This must be greater than or equal to
559+
preferred_min_stream_count. Typically, clients should
560+
either leave this unset to let the system to determine
561+
an upper bound OR set this a size for the maximum "units
562+
of work" it can gracefully handle.
563563
564564
This corresponds to the ``max_stream_count`` field
565565
on the ``request`` instance; if ``request`` is provided, this

google/cloud/bigquery_storage_v1/services/big_query_read/transports/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def __init__(
5858
quota_project_id: Optional[str] = None,
5959
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6060
always_use_jwt_access: Optional[bool] = False,
61+
api_audience: Optional[str] = None,
6162
**kwargs,
6263
) -> None:
6364
"""Instantiate the transport.
@@ -85,11 +86,6 @@ def __init__(
8586
be used for service account credentials.
8687
"""
8788

88-
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
89-
if ":" not in host:
90-
host += ":443"
91-
self._host = host
92-
9389
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
9490

9591
# Save the scopes.
@@ -110,6 +106,11 @@ def __init__(
110106
credentials, _ = google.auth.default(
111107
**scopes_kwargs, quota_project_id=quota_project_id
112108
)
109+
# Don't apply audience if the credentials file passed from user.
110+
if hasattr(credentials, "with_gdch_audience"):
111+
credentials = credentials.with_gdch_audience(
112+
api_audience if api_audience else host
113+
)
113114

114115
# If the credentials are service account credentials, then always try to use self signed JWT.
115116
if (
@@ -122,6 +123,11 @@ def __init__(
122123
# Save the credentials.
123124
self._credentials = credentials
124125

126+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
127+
if ":" not in host:
128+
host += ":443"
129+
self._host = host
130+
125131
def _prep_wrapped_messages(self, client_info):
126132
# Precompute the wrapped methods.
127133
self._wrapped_methods = {

google/cloud/bigquery_storage_v1/services/big_query_read/transports/grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def __init__(
6060
quota_project_id: Optional[str] = None,
6161
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6262
always_use_jwt_access: Optional[bool] = False,
63+
api_audience: Optional[str] = None,
6364
) -> None:
6465
"""Instantiate the transport.
6566
@@ -155,6 +156,7 @@ def __init__(
155156
quota_project_id=quota_project_id,
156157
client_info=client_info,
157158
always_use_jwt_access=always_use_jwt_access,
159+
api_audience=api_audience,
158160
)
159161

160162
if not self._grpc_channel:

google/cloud/bigquery_storage_v1/services/big_query_read/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def __init__(
105105
quota_project_id=None,
106106
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
107107
always_use_jwt_access: Optional[bool] = False,
108+
api_audience: Optional[str] = None,
108109
) -> None:
109110
"""Instantiate the transport.
110111
@@ -200,6 +201,7 @@ def __init__(
200201
quota_project_id=quota_project_id,
201202
client_info=client_info,
202203
always_use_jwt_access=always_use_jwt_access,
204+
api_audience=api_audience,
203205
)
204206

205207
if not self._grpc_channel:

google/cloud/bigquery_storage_v1/services/big_query_write/async_client.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,17 @@ async def sample_create_write_stream():
313313
rpc = gapic_v1.method_async.wrap_method(
314314
self._client._transport.create_write_stream,
315315
default_retry=retries.Retry(
316-
initial=0.1,
317-
maximum=60.0,
316+
initial=10.0,
317+
maximum=120.0,
318318
multiplier=1.3,
319319
predicate=retries.if_exception_type(
320320
core_exceptions.DeadlineExceeded,
321+
core_exceptions.ResourceExhausted,
321322
core_exceptions.ServiceUnavailable,
322323
),
323-
deadline=600.0,
324+
deadline=1200.0,
324325
),
325-
default_timeout=600.0,
326+
default_timeout=1200.0,
326327
client_info=DEFAULT_CLIENT_INFO,
327328
)
328329

google/cloud/bigquery_storage_v1/services/big_query_write/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ def __init__(
463463
quota_project_id=client_options.quota_project_id,
464464
client_info=client_info,
465465
always_use_jwt_access=True,
466+
api_audience=client_options.api_audience,
466467
)
467468

468469
def create_write_stream(

google/cloud/bigquery_storage_v1/services/big_query_write/transports/base.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def __init__(
5959
quota_project_id: Optional[str] = None,
6060
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6161
always_use_jwt_access: Optional[bool] = False,
62+
api_audience: Optional[str] = None,
6263
**kwargs,
6364
) -> None:
6465
"""Instantiate the transport.
@@ -86,11 +87,6 @@ def __init__(
8687
be used for service account credentials.
8788
"""
8889

89-
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
90-
if ":" not in host:
91-
host += ":443"
92-
self._host = host
93-
9490
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
9591

9692
# Save the scopes.
@@ -111,6 +107,11 @@ def __init__(
111107
credentials, _ = google.auth.default(
112108
**scopes_kwargs, quota_project_id=quota_project_id
113109
)
110+
# Don't apply audience if the credentials file passed from user.
111+
if hasattr(credentials, "with_gdch_audience"):
112+
credentials = credentials.with_gdch_audience(
113+
api_audience if api_audience else host
114+
)
114115

115116
# If the credentials are service account credentials, then always try to use self signed JWT.
116117
if (
@@ -123,22 +124,28 @@ def __init__(
123124
# Save the credentials.
124125
self._credentials = credentials
125126

127+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
128+
if ":" not in host:
129+
host += ":443"
130+
self._host = host
131+
126132
def _prep_wrapped_messages(self, client_info):
127133
# Precompute the wrapped methods.
128134
self._wrapped_methods = {
129135
self.create_write_stream: gapic_v1.method.wrap_method(
130136
self.create_write_stream,
131137
default_retry=retries.Retry(
132-
initial=0.1,
133-
maximum=60.0,
138+
initial=10.0,
139+
maximum=120.0,
134140
multiplier=1.3,
135141
predicate=retries.if_exception_type(
136142
core_exceptions.DeadlineExceeded,
143+
core_exceptions.ResourceExhausted,
137144
core_exceptions.ServiceUnavailable,
138145
),
139-
deadline=600.0,
146+
deadline=1200.0,
140147
),
141-
default_timeout=600.0,
148+
default_timeout=1200.0,
142149
client_info=client_info,
143150
),
144151
self.append_rows: gapic_v1.method.wrap_method(

google/cloud/bigquery_storage_v1/services/big_query_write/transports/grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def __init__(
6262
quota_project_id: Optional[str] = None,
6363
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6464
always_use_jwt_access: Optional[bool] = False,
65+
api_audience: Optional[str] = None,
6566
) -> None:
6667
"""Instantiate the transport.
6768
@@ -157,6 +158,7 @@ def __init__(
157158
quota_project_id=quota_project_id,
158159
client_info=client_info,
159160
always_use_jwt_access=always_use_jwt_access,
161+
api_audience=api_audience,
160162
)
161163

162164
if not self._grpc_channel:

0 commit comments

Comments
 (0)