Skip to content

Commit

Permalink
feat: add trace_id for Read API (#396)
Browse files Browse the repository at this point in the history
* feat: add trace_id for Read API

PiperOrigin-RevId: 429809867

Source-Link: googleapis/googleapis@6052603

Source-Link: googleapis/googleapis-gen@840dd14
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODQwZGQxNGM5MWEwZWM2NmQ5YmQxYTAyOGQwMWI1ZmQwMjljYTAyZSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 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 Feb 22, 2022
1 parent e08d2fd commit 5d7f918
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions google/cloud/bigquery_storage_v1/types/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ class ReadSession(proto.Message):
are completely consumed. This estimate is based
on metadata from the table which might be
incomplete or stale.
trace_id (str):
Optional. ID set by client to annotate a
session identity. This does not need to be
strictly unique, but instead the same ID should
be used to group logically connected sessions
(e.g. All using the same ID for all sessions
needed to complete a Spark SQL query is
reasonable).
Maximum length is 256 bytes.
"""

class TableModifiers(proto.Message):
Expand Down Expand Up @@ -154,6 +163,7 @@ class TableReadOptions(proto.Message):
read_options = proto.Field(proto.MESSAGE, number=8, message=TableReadOptions,)
streams = proto.RepeatedField(proto.MESSAGE, number=10, message="ReadStream",)
estimated_total_bytes_scanned = proto.Field(proto.INT64, number=12,)
trace_id = proto.Field(proto.STRING, number=13,)


class ReadStream(proto.Message):
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/gapic/bigquery_storage_v1/test_big_query_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ def test_create_read_session(request_type, transport: str = "grpc"):
data_format=stream.DataFormat.AVRO,
table="table_value",
estimated_total_bytes_scanned=3076,
trace_id="trace_id_value",
avro_schema=avro.AvroSchema(schema="schema_value"),
)
response = client.create_read_session(request)
Expand All @@ -657,6 +658,7 @@ def test_create_read_session(request_type, transport: str = "grpc"):
assert response.data_format == stream.DataFormat.AVRO
assert response.table == "table_value"
assert response.estimated_total_bytes_scanned == 3076
assert response.trace_id == "trace_id_value"


def test_create_read_session_empty_call():
Expand Down Expand Up @@ -699,6 +701,7 @@ async def test_create_read_session_async(
data_format=stream.DataFormat.AVRO,
table="table_value",
estimated_total_bytes_scanned=3076,
trace_id="trace_id_value",
)
)
response = await client.create_read_session(request)
Expand All @@ -714,6 +717,7 @@ async def test_create_read_session_async(
assert response.data_format == stream.DataFormat.AVRO
assert response.table == "table_value"
assert response.estimated_total_bytes_scanned == 3076
assert response.trace_id == "trace_id_value"


@pytest.mark.asyncio
Expand Down

0 comments on commit 5d7f918

Please sign in to comment.