Skip to content

Commit

Permalink
feat: add experimental ArrowData type and arrow_data field within App…
Browse files Browse the repository at this point in the history
…endRowsRequest (#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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Oct 14, 2024
1 parent 4c87178 commit 03a99ff
Show file tree
Hide file tree
Showing 17 changed files with 1,629 additions and 1,193 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

transport inheritance structure
_______________________________

`BigQueryReadTransport` is the ABC for all transports.
- public child `BigQueryReadGrpcTransport` for sync gRPC transport (defined in `grpc.py`).
- public child `BigQueryReadGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`).
- private child `_BaseBigQueryReadRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`).
- public child `BigQueryReadRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`).
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import inspect
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
import warnings

Expand Down Expand Up @@ -228,6 +229,9 @@ def __init__(
)

# Wrap messages. This must be done after self._grpc_channel exists
self._wrap_with_kind = (
"kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
)
self._prep_wrapped_messages(client_info)

@property
Expand Down Expand Up @@ -364,7 +368,7 @@ def split_read_stream(
def _prep_wrapped_messages(self, client_info):
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
self._wrapped_methods = {
self.create_read_session: gapic_v1.method_async.wrap_method(
self.create_read_session: self._wrap_method(
self.create_read_session,
default_retry=retries.AsyncRetry(
initial=0.1,
Expand All @@ -379,7 +383,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=600.0,
client_info=client_info,
),
self.read_rows: gapic_v1.method_async.wrap_method(
self.read_rows: self._wrap_method(
self.read_rows,
default_retry=retries.AsyncRetry(
initial=0.1,
Expand All @@ -393,7 +397,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=86400.0,
client_info=client_info,
),
self.split_read_stream: gapic_v1.method_async.wrap_method(
self.split_read_stream: self._wrap_method(
self.split_read_stream,
default_retry=retries.AsyncRetry(
initial=0.1,
Expand All @@ -410,8 +414,17 @@ def _prep_wrapped_messages(self, client_info):
),
}

def _wrap_method(self, func, *args, **kwargs):
if self._wrap_with_kind: # pragma: NO COVER
kwargs["kind"] = self.kind
return gapic_v1.method_async.wrap_method(func, *args, **kwargs)

def close(self):
return self.grpc_channel.close()

@property
def kind(self) -> str:
return "grpc_asyncio"


__all__ = ("BigQueryReadGrpcAsyncIOTransport",)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

transport inheritance structure
_______________________________

`BigQueryWriteTransport` is the ABC for all transports.
- public child `BigQueryWriteGrpcTransport` for sync gRPC transport (defined in `grpc.py`).
- public child `BigQueryWriteGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`).
- private child `_BaseBigQueryWriteRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`).
- public child `BigQueryWriteRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`).
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import inspect
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
import warnings

Expand Down Expand Up @@ -232,6 +233,9 @@ def __init__(
)

# Wrap messages. This must be done after self._grpc_channel exists
self._wrap_with_kind = (
"kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
)
self._prep_wrapped_messages(client_info)

@property
Expand Down Expand Up @@ -463,7 +467,7 @@ def flush_rows(
def _prep_wrapped_messages(self, client_info):
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
self._wrapped_methods = {
self.create_write_stream: gapic_v1.method_async.wrap_method(
self.create_write_stream: self._wrap_method(
self.create_write_stream,
default_retry=retries.AsyncRetry(
initial=10.0,
Expand All @@ -479,7 +483,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=1200.0,
client_info=client_info,
),
self.append_rows: gapic_v1.method_async.wrap_method(
self.append_rows: self._wrap_method(
self.append_rows,
default_retry=retries.AsyncRetry(
initial=0.1,
Expand All @@ -493,7 +497,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=86400.0,
client_info=client_info,
),
self.get_write_stream: gapic_v1.method_async.wrap_method(
self.get_write_stream: self._wrap_method(
self.get_write_stream,
default_retry=retries.AsyncRetry(
initial=0.1,
Expand All @@ -509,7 +513,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=600.0,
client_info=client_info,
),
self.finalize_write_stream: gapic_v1.method_async.wrap_method(
self.finalize_write_stream: self._wrap_method(
self.finalize_write_stream,
default_retry=retries.AsyncRetry(
initial=0.1,
Expand All @@ -525,7 +529,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=600.0,
client_info=client_info,
),
self.batch_commit_write_streams: gapic_v1.method_async.wrap_method(
self.batch_commit_write_streams: self._wrap_method(
self.batch_commit_write_streams,
default_retry=retries.AsyncRetry(
initial=0.1,
Expand All @@ -541,7 +545,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=600.0,
client_info=client_info,
),
self.flush_rows: gapic_v1.method_async.wrap_method(
self.flush_rows: self._wrap_method(
self.flush_rows,
default_retry=retries.AsyncRetry(
initial=0.1,
Expand All @@ -559,8 +563,17 @@ def _prep_wrapped_messages(self, client_info):
),
}

def _wrap_method(self, func, *args, **kwargs):
if self._wrap_with_kind: # pragma: NO COVER
kwargs["kind"] = self.kind
return gapic_v1.method_async.wrap_method(func, *args, **kwargs)

def close(self):
return self.grpc_channel.close()

@property
def kind(self) -> str:
return "grpc_asyncio"


__all__ = ("BigQueryWriteGrpcAsyncIOTransport",)
40 changes: 40 additions & 0 deletions google/cloud/bigquery_storage_v1/types/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ class AppendRowsRequest(proto.Message):
size. Requests larger than this return an error, typically
``INVALID_ARGUMENT``.
This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Expand Down Expand Up @@ -436,6 +440,11 @@ class AppendRowsRequest(proto.Message):
proto_rows (google.cloud.bigquery_storage_v1.types.AppendRowsRequest.ProtoData):
Rows in proto format.
This field is a member of `oneof`_ ``rows``.
arrow_rows (google.cloud.bigquery_storage_v1.types.AppendRowsRequest.ArrowData):
Rows in arrow format. This is an experimental
feature only selected for allowlisted customers.
This field is a member of `oneof`_ ``rows``.
trace_id (str):
Id set by client to annotate its identity.
Expand Down Expand Up @@ -496,6 +505,31 @@ class MissingValueInterpretation(proto.Enum):
NULL_VALUE = 1
DEFAULT_VALUE = 2

class ArrowData(proto.Message):
r"""Arrow schema and data.
Arrow format is an experimental feature only selected for
allowlisted customers.
Attributes:
writer_schema (google.cloud.bigquery_storage_v1.types.ArrowSchema):
Optional. Arrow Schema used to serialize the
data.
rows (google.cloud.bigquery_storage_v1.types.ArrowRecordBatch):
Required. Serialized row data in Arrow
format.
"""

writer_schema: arrow.ArrowSchema = proto.Field(
proto.MESSAGE,
number=1,
message=arrow.ArrowSchema,
)
rows: arrow.ArrowRecordBatch = proto.Field(
proto.MESSAGE,
number=2,
message=arrow.ArrowRecordBatch,
)

class ProtoData(proto.Message):
r"""ProtoData contains the data rows and schema when constructing
append requests.
Expand Down Expand Up @@ -544,6 +578,12 @@ class ProtoData(proto.Message):
oneof="rows",
message=ProtoData,
)
arrow_rows: ArrowData = proto.Field(
proto.MESSAGE,
number=5,
oneof="rows",
message=ArrowData,
)
trace_id: str = proto.Field(
proto.STRING,
number=6,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

transport inheritance structure
_______________________________

`MetastorePartitionServiceTransport` is the ABC for all transports.
- public child `MetastorePartitionServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`).
- public child `MetastorePartitionServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`).
- private child `_BaseMetastorePartitionServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`).
- public child `MetastorePartitionServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`).
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import inspect
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
import warnings

Expand Down Expand Up @@ -230,6 +231,9 @@ def __init__(
)

# Wrap messages. This must be done after self._grpc_channel exists
self._wrap_with_kind = (
"kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
)
self._prep_wrapped_messages(client_info)

@property
Expand Down Expand Up @@ -408,7 +412,7 @@ def stream_metastore_partitions(
def _prep_wrapped_messages(self, client_info):
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
self._wrapped_methods = {
self.batch_create_metastore_partitions: gapic_v1.method_async.wrap_method(
self.batch_create_metastore_partitions: self._wrap_method(
self.batch_create_metastore_partitions,
default_retry=retries.AsyncRetry(
initial=0.1,
Expand All @@ -422,7 +426,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=240.0,
client_info=client_info,
),
self.batch_delete_metastore_partitions: gapic_v1.method_async.wrap_method(
self.batch_delete_metastore_partitions: self._wrap_method(
self.batch_delete_metastore_partitions,
default_retry=retries.AsyncRetry(
initial=0.1,
Expand All @@ -436,7 +440,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=240.0,
client_info=client_info,
),
self.batch_update_metastore_partitions: gapic_v1.method_async.wrap_method(
self.batch_update_metastore_partitions: self._wrap_method(
self.batch_update_metastore_partitions,
default_retry=retries.AsyncRetry(
initial=0.1,
Expand All @@ -450,7 +454,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=240.0,
client_info=client_info,
),
self.list_metastore_partitions: gapic_v1.method_async.wrap_method(
self.list_metastore_partitions: self._wrap_method(
self.list_metastore_partitions,
default_retry=retries.AsyncRetry(
initial=0.1,
Expand All @@ -464,15 +468,24 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=240.0,
client_info=client_info,
),
self.stream_metastore_partitions: gapic_v1.method_async.wrap_method(
self.stream_metastore_partitions: self._wrap_method(
self.stream_metastore_partitions,
default_timeout=240.0,
client_info=client_info,
),
}

def _wrap_method(self, func, *args, **kwargs):
if self._wrap_with_kind: # pragma: NO COVER
kwargs["kind"] = self.kind
return gapic_v1.method_async.wrap_method(func, *args, **kwargs)

def close(self):
return self.grpc_channel.close()

@property
def kind(self) -> str:
return "grpc_asyncio"


__all__ = ("MetastorePartitionServiceGrpcAsyncIOTransport",)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

transport inheritance structure
_______________________________

`BigQueryReadTransport` is the ABC for all transports.
- public child `BigQueryReadGrpcTransport` for sync gRPC transport (defined in `grpc.py`).
- public child `BigQueryReadGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`).
- private child `_BaseBigQueryReadRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`).
- public child `BigQueryReadRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`).
Loading

0 comments on commit 03a99ff

Please sign in to comment.