diff --git a/google/cloud/bigquery_storage_v1/types/stream.py b/google/cloud/bigquery_storage_v1/types/stream.py index 0faff50f..aa527022 100644 --- a/google/cloud/bigquery_storage_v1/types/stream.py +++ b/google/cloud/bigquery_storage_v1/types/stream.py @@ -194,6 +194,8 @@ class WriteStream(proto.Message): generate data that's compatible with this schema to send in initial ``AppendRowsRequest``. The table schema could go out of date during the life time of the stream. + write_mode (google.cloud.bigquery_storage_v1.types.WriteStream.WriteMode): + Immutable. Mode of the stream. """ class Type(proto.Enum): @@ -203,11 +205,17 @@ class Type(proto.Enum): PENDING = 2 BUFFERED = 3 + class WriteMode(proto.Enum): + r"""Mode enum of the stream.""" + WRITE_MODE_UNSPECIFIED = 0 + INSERT = 1 + name = proto.Field(proto.STRING, number=1,) type_ = proto.Field(proto.ENUM, number=2, enum=Type,) create_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) commit_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) table_schema = proto.Field(proto.MESSAGE, number=5, message=gcbs_table.TableSchema,) + write_mode = proto.Field(proto.ENUM, number=7, enum=WriteMode,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/tests/unit/gapic/bigquery_storage_v1/test_big_query_write.py b/tests/unit/gapic/bigquery_storage_v1/test_big_query_write.py index 76bdfd8e..6d1f1d43 100644 --- a/tests/unit/gapic/bigquery_storage_v1/test_big_query_write.py +++ b/tests/unit/gapic/bigquery_storage_v1/test_big_query_write.py @@ -504,7 +504,9 @@ def test_create_write_stream( ) as call: # Designate an appropriate return value for the call. call.return_value = stream.WriteStream( - name="name_value", type_=stream.WriteStream.Type.COMMITTED, + name="name_value", + type_=stream.WriteStream.Type.COMMITTED, + write_mode=stream.WriteStream.WriteMode.INSERT, ) response = client.create_write_stream(request) @@ -517,6 +519,7 @@ def test_create_write_stream( assert isinstance(response, stream.WriteStream) assert response.name == "name_value" assert response.type_ == stream.WriteStream.Type.COMMITTED + assert response.write_mode == stream.WriteStream.WriteMode.INSERT def test_create_write_stream_from_dict(): @@ -559,7 +562,9 @@ async def test_create_write_stream_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( stream.WriteStream( - name="name_value", type_=stream.WriteStream.Type.COMMITTED, + name="name_value", + type_=stream.WriteStream.Type.COMMITTED, + write_mode=stream.WriteStream.WriteMode.INSERT, ) ) response = await client.create_write_stream(request) @@ -573,6 +578,7 @@ async def test_create_write_stream_async( assert isinstance(response, stream.WriteStream) assert response.name == "name_value" assert response.type_ == stream.WriteStream.Type.COMMITTED + assert response.write_mode == stream.WriteStream.WriteMode.INSERT @pytest.mark.asyncio @@ -805,7 +811,9 @@ def test_get_write_stream( with mock.patch.object(type(client.transport.get_write_stream), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = stream.WriteStream( - name="name_value", type_=stream.WriteStream.Type.COMMITTED, + name="name_value", + type_=stream.WriteStream.Type.COMMITTED, + write_mode=stream.WriteStream.WriteMode.INSERT, ) response = client.get_write_stream(request) @@ -818,6 +826,7 @@ def test_get_write_stream( assert isinstance(response, stream.WriteStream) assert response.name == "name_value" assert response.type_ == stream.WriteStream.Type.COMMITTED + assert response.write_mode == stream.WriteStream.WriteMode.INSERT def test_get_write_stream_from_dict(): @@ -856,7 +865,9 @@ async def test_get_write_stream_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( stream.WriteStream( - name="name_value", type_=stream.WriteStream.Type.COMMITTED, + name="name_value", + type_=stream.WriteStream.Type.COMMITTED, + write_mode=stream.WriteStream.WriteMode.INSERT, ) ) response = await client.get_write_stream(request) @@ -870,6 +881,7 @@ async def test_get_write_stream_async( assert isinstance(response, stream.WriteStream) assert response.name == "name_value" assert response.type_ == stream.WriteStream.Type.COMMITTED + assert response.write_mode == stream.WriteStream.WriteMode.INSERT @pytest.mark.asyncio