Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add estimated number of rows to CreateReadSession response #542

Merged
merged 2 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions google/cloud/bigquery_storage_v1/types/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ class ReadSession(proto.Message):
are completely consumed. This estimate is based
on metadata from the table which might be
incomplete or stale.
estimated_row_count (int):
Output only. An estimate on the number of
rows present in this session's streams. 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
Expand Down Expand Up @@ -268,6 +273,10 @@ class TableReadOptions(proto.Message):
proto.INT64,
number=12,
)
estimated_row_count: int = proto.Field(
proto.INT64,
number=14,
)
trace_id: str = proto.Field(
proto.STRING,
number=13,
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 @@ -702,6 +702,7 @@ def test_create_read_session(request_type, transport: str = "grpc"):
data_format=stream.DataFormat.AVRO,
table="table_value",
estimated_total_bytes_scanned=3076,
estimated_row_count=2047,
trace_id="trace_id_value",
avro_schema=avro.AvroSchema(schema="schema_value"),
)
Expand All @@ -718,6 +719,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.estimated_row_count == 2047
assert response.trace_id == "trace_id_value"


Expand Down Expand Up @@ -763,6 +765,7 @@ async def test_create_read_session_async(
data_format=stream.DataFormat.AVRO,
table="table_value",
estimated_total_bytes_scanned=3076,
estimated_row_count=2047,
trace_id="trace_id_value",
)
)
Expand All @@ -779,6 +782,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.estimated_row_count == 2047
assert response.trace_id == "trace_id_value"


Expand Down