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

Commit 03a99ff

Browse files
feat: add experimental ArrowData type and arrow_data field within AppendRowsRequest (#837)
* chore: Update gapic-generator-python to v1.19.1 PiperOrigin-RevId: 684571179 Source-Link: googleapis/googleapis@fbdc238 Source-Link: googleapis/googleapis-gen@3a2cdcf Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiM2EyY2RjZmI4MGMyZDBmNWVjMGNjNjYzYzJiYWIwYTk0ODYyMjlkMCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: add experimental ArrowData type and arrow_data field within AppendRowsRequest PiperOrigin-RevId: 684900949 Source-Link: googleapis/googleapis@b49a983 Source-Link: googleapis/googleapis-gen@34ddd03 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzRkZGQwMzk5Mzg2YWViMWQ0YWI1ZDM5N2E2ZGNjZTU5MDhhMTZmMCJ9 * 🦉 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>
1 parent 4c87178 commit 03a99ff

17 files changed

Lines changed: 1629 additions & 1193 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
transport inheritance structure
3+
_______________________________
4+
5+
`BigQueryReadTransport` is the ABC for all transports.
6+
- public child `BigQueryReadGrpcTransport` for sync gRPC transport (defined in `grpc.py`).
7+
- public child `BigQueryReadGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`).
8+
- private child `_BaseBigQueryReadRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`).
9+
- public child `BigQueryReadRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`).

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16+
import inspect
1617
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
1718
import warnings
1819

@@ -228,6 +229,9 @@ def __init__(
228229
)
229230

230231
# Wrap messages. This must be done after self._grpc_channel exists
232+
self._wrap_with_kind = (
233+
"kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
234+
)
231235
self._prep_wrapped_messages(client_info)
232236

233237
@property
@@ -364,7 +368,7 @@ def split_read_stream(
364368
def _prep_wrapped_messages(self, client_info):
365369
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
366370
self._wrapped_methods = {
367-
self.create_read_session: gapic_v1.method_async.wrap_method(
371+
self.create_read_session: self._wrap_method(
368372
self.create_read_session,
369373
default_retry=retries.AsyncRetry(
370374
initial=0.1,
@@ -379,7 +383,7 @@ def _prep_wrapped_messages(self, client_info):
379383
default_timeout=600.0,
380384
client_info=client_info,
381385
),
382-
self.read_rows: gapic_v1.method_async.wrap_method(
386+
self.read_rows: self._wrap_method(
383387
self.read_rows,
384388
default_retry=retries.AsyncRetry(
385389
initial=0.1,
@@ -393,7 +397,7 @@ def _prep_wrapped_messages(self, client_info):
393397
default_timeout=86400.0,
394398
client_info=client_info,
395399
),
396-
self.split_read_stream: gapic_v1.method_async.wrap_method(
400+
self.split_read_stream: self._wrap_method(
397401
self.split_read_stream,
398402
default_retry=retries.AsyncRetry(
399403
initial=0.1,
@@ -410,8 +414,17 @@ def _prep_wrapped_messages(self, client_info):
410414
),
411415
}
412416

417+
def _wrap_method(self, func, *args, **kwargs):
418+
if self._wrap_with_kind: # pragma: NO COVER
419+
kwargs["kind"] = self.kind
420+
return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
421+
413422
def close(self):
414423
return self.grpc_channel.close()
415424

425+
@property
426+
def kind(self) -> str:
427+
return "grpc_asyncio"
428+
416429

417430
__all__ = ("BigQueryReadGrpcAsyncIOTransport",)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
transport inheritance structure
3+
_______________________________
4+
5+
`BigQueryWriteTransport` is the ABC for all transports.
6+
- public child `BigQueryWriteGrpcTransport` for sync gRPC transport (defined in `grpc.py`).
7+
- public child `BigQueryWriteGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`).
8+
- private child `_BaseBigQueryWriteRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`).
9+
- public child `BigQueryWriteRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`).

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16+
import inspect
1617
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
1718
import warnings
1819

@@ -232,6 +233,9 @@ def __init__(
232233
)
233234

234235
# Wrap messages. This must be done after self._grpc_channel exists
236+
self._wrap_with_kind = (
237+
"kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
238+
)
235239
self._prep_wrapped_messages(client_info)
236240

237241
@property
@@ -463,7 +467,7 @@ def flush_rows(
463467
def _prep_wrapped_messages(self, client_info):
464468
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
465469
self._wrapped_methods = {
466-
self.create_write_stream: gapic_v1.method_async.wrap_method(
470+
self.create_write_stream: self._wrap_method(
467471
self.create_write_stream,
468472
default_retry=retries.AsyncRetry(
469473
initial=10.0,
@@ -479,7 +483,7 @@ def _prep_wrapped_messages(self, client_info):
479483
default_timeout=1200.0,
480484
client_info=client_info,
481485
),
482-
self.append_rows: gapic_v1.method_async.wrap_method(
486+
self.append_rows: self._wrap_method(
483487
self.append_rows,
484488
default_retry=retries.AsyncRetry(
485489
initial=0.1,
@@ -493,7 +497,7 @@ def _prep_wrapped_messages(self, client_info):
493497
default_timeout=86400.0,
494498
client_info=client_info,
495499
),
496-
self.get_write_stream: gapic_v1.method_async.wrap_method(
500+
self.get_write_stream: self._wrap_method(
497501
self.get_write_stream,
498502
default_retry=retries.AsyncRetry(
499503
initial=0.1,
@@ -509,7 +513,7 @@ def _prep_wrapped_messages(self, client_info):
509513
default_timeout=600.0,
510514
client_info=client_info,
511515
),
512-
self.finalize_write_stream: gapic_v1.method_async.wrap_method(
516+
self.finalize_write_stream: self._wrap_method(
513517
self.finalize_write_stream,
514518
default_retry=retries.AsyncRetry(
515519
initial=0.1,
@@ -525,7 +529,7 @@ def _prep_wrapped_messages(self, client_info):
525529
default_timeout=600.0,
526530
client_info=client_info,
527531
),
528-
self.batch_commit_write_streams: gapic_v1.method_async.wrap_method(
532+
self.batch_commit_write_streams: self._wrap_method(
529533
self.batch_commit_write_streams,
530534
default_retry=retries.AsyncRetry(
531535
initial=0.1,
@@ -541,7 +545,7 @@ def _prep_wrapped_messages(self, client_info):
541545
default_timeout=600.0,
542546
client_info=client_info,
543547
),
544-
self.flush_rows: gapic_v1.method_async.wrap_method(
548+
self.flush_rows: self._wrap_method(
545549
self.flush_rows,
546550
default_retry=retries.AsyncRetry(
547551
initial=0.1,
@@ -559,8 +563,17 @@ def _prep_wrapped_messages(self, client_info):
559563
),
560564
}
561565

566+
def _wrap_method(self, func, *args, **kwargs):
567+
if self._wrap_with_kind: # pragma: NO COVER
568+
kwargs["kind"] = self.kind
569+
return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
570+
562571
def close(self):
563572
return self.grpc_channel.close()
564573

574+
@property
575+
def kind(self) -> str:
576+
return "grpc_asyncio"
577+
565578

566579
__all__ = ("BigQueryWriteGrpcAsyncIOTransport",)

google/cloud/bigquery_storage_v1/types/storage.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,10 @@ class AppendRowsRequest(proto.Message):
389389
size. Requests larger than this return an error, typically
390390
``INVALID_ARGUMENT``.
391391
392+
This message has `oneof`_ fields (mutually exclusive fields).
393+
For each oneof, at most one member field can be set at the same time.
394+
Setting any member of the oneof automatically clears all other
395+
members.
392396
393397
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
394398
@@ -436,6 +440,11 @@ class AppendRowsRequest(proto.Message):
436440
proto_rows (google.cloud.bigquery_storage_v1.types.AppendRowsRequest.ProtoData):
437441
Rows in proto format.
438442
443+
This field is a member of `oneof`_ ``rows``.
444+
arrow_rows (google.cloud.bigquery_storage_v1.types.AppendRowsRequest.ArrowData):
445+
Rows in arrow format. This is an experimental
446+
feature only selected for allowlisted customers.
447+
439448
This field is a member of `oneof`_ ``rows``.
440449
trace_id (str):
441450
Id set by client to annotate its identity.
@@ -496,6 +505,31 @@ class MissingValueInterpretation(proto.Enum):
496505
NULL_VALUE = 1
497506
DEFAULT_VALUE = 2
498507

508+
class ArrowData(proto.Message):
509+
r"""Arrow schema and data.
510+
Arrow format is an experimental feature only selected for
511+
allowlisted customers.
512+
513+
Attributes:
514+
writer_schema (google.cloud.bigquery_storage_v1.types.ArrowSchema):
515+
Optional. Arrow Schema used to serialize the
516+
data.
517+
rows (google.cloud.bigquery_storage_v1.types.ArrowRecordBatch):
518+
Required. Serialized row data in Arrow
519+
format.
520+
"""
521+
522+
writer_schema: arrow.ArrowSchema = proto.Field(
523+
proto.MESSAGE,
524+
number=1,
525+
message=arrow.ArrowSchema,
526+
)
527+
rows: arrow.ArrowRecordBatch = proto.Field(
528+
proto.MESSAGE,
529+
number=2,
530+
message=arrow.ArrowRecordBatch,
531+
)
532+
499533
class ProtoData(proto.Message):
500534
r"""ProtoData contains the data rows and schema when constructing
501535
append requests.
@@ -544,6 +578,12 @@ class ProtoData(proto.Message):
544578
oneof="rows",
545579
message=ProtoData,
546580
)
581+
arrow_rows: ArrowData = proto.Field(
582+
proto.MESSAGE,
583+
number=5,
584+
oneof="rows",
585+
message=ArrowData,
586+
)
547587
trace_id: str = proto.Field(
548588
proto.STRING,
549589
number=6,
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
transport inheritance structure
3+
_______________________________
4+
5+
`MetastorePartitionServiceTransport` is the ABC for all transports.
6+
- public child `MetastorePartitionServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`).
7+
- public child `MetastorePartitionServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`).
8+
- private child `_BaseMetastorePartitionServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`).
9+
- public child `MetastorePartitionServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`).

google/cloud/bigquery_storage_v1alpha/services/metastore_partition_service/transports/grpc_asyncio.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16+
import inspect
1617
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
1718
import warnings
1819

@@ -230,6 +231,9 @@ def __init__(
230231
)
231232

232233
# Wrap messages. This must be done after self._grpc_channel exists
234+
self._wrap_with_kind = (
235+
"kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
236+
)
233237
self._prep_wrapped_messages(client_info)
234238

235239
@property
@@ -408,7 +412,7 @@ def stream_metastore_partitions(
408412
def _prep_wrapped_messages(self, client_info):
409413
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
410414
self._wrapped_methods = {
411-
self.batch_create_metastore_partitions: gapic_v1.method_async.wrap_method(
415+
self.batch_create_metastore_partitions: self._wrap_method(
412416
self.batch_create_metastore_partitions,
413417
default_retry=retries.AsyncRetry(
414418
initial=0.1,
@@ -422,7 +426,7 @@ def _prep_wrapped_messages(self, client_info):
422426
default_timeout=240.0,
423427
client_info=client_info,
424428
),
425-
self.batch_delete_metastore_partitions: gapic_v1.method_async.wrap_method(
429+
self.batch_delete_metastore_partitions: self._wrap_method(
426430
self.batch_delete_metastore_partitions,
427431
default_retry=retries.AsyncRetry(
428432
initial=0.1,
@@ -436,7 +440,7 @@ def _prep_wrapped_messages(self, client_info):
436440
default_timeout=240.0,
437441
client_info=client_info,
438442
),
439-
self.batch_update_metastore_partitions: gapic_v1.method_async.wrap_method(
443+
self.batch_update_metastore_partitions: self._wrap_method(
440444
self.batch_update_metastore_partitions,
441445
default_retry=retries.AsyncRetry(
442446
initial=0.1,
@@ -450,7 +454,7 @@ def _prep_wrapped_messages(self, client_info):
450454
default_timeout=240.0,
451455
client_info=client_info,
452456
),
453-
self.list_metastore_partitions: gapic_v1.method_async.wrap_method(
457+
self.list_metastore_partitions: self._wrap_method(
454458
self.list_metastore_partitions,
455459
default_retry=retries.AsyncRetry(
456460
initial=0.1,
@@ -464,15 +468,24 @@ def _prep_wrapped_messages(self, client_info):
464468
default_timeout=240.0,
465469
client_info=client_info,
466470
),
467-
self.stream_metastore_partitions: gapic_v1.method_async.wrap_method(
471+
self.stream_metastore_partitions: self._wrap_method(
468472
self.stream_metastore_partitions,
469473
default_timeout=240.0,
470474
client_info=client_info,
471475
),
472476
}
473477

478+
def _wrap_method(self, func, *args, **kwargs):
479+
if self._wrap_with_kind: # pragma: NO COVER
480+
kwargs["kind"] = self.kind
481+
return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
482+
474483
def close(self):
475484
return self.grpc_channel.close()
476485

486+
@property
487+
def kind(self) -> str:
488+
return "grpc_asyncio"
489+
477490

478491
__all__ = ("MetastorePartitionServiceGrpcAsyncIOTransport",)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
transport inheritance structure
3+
_______________________________
4+
5+
`BigQueryReadTransport` is the ABC for all transports.
6+
- public child `BigQueryReadGrpcTransport` for sync gRPC transport (defined in `grpc.py`).
7+
- public child `BigQueryReadGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`).
8+
- private child `_BaseBigQueryReadRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`).
9+
- public child `BigQueryReadRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`).

0 commit comments

Comments
 (0)