Skip to content

Commit 52da520

Browse files
authored
fix: Pass app_profile_id when building updated request (#512)
- Pass the app_profile_id from the message - Update unittest Fixes internal bug #214449800
1 parent e2fc0c9 commit 52da520

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

packages/google-cloud-bigtable/google/cloud/bigtable/row_data.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,9 +624,13 @@ def __init__(self, message, last_scanned_key, rows_read_so_far):
624624

625625
def build_updated_request(self):
626626
"""Updates the given message request as per last scanned key"""
627+
628+
# TODO: Generalize this to ensure fields don't get rewritten when retrying the request
629+
627630
r_kwargs = {
628631
"table_name": self.message.table_name,
629632
"filter": self.message.filter,
633+
"app_profile_id": self.message.app_profile_id,
630634
}
631635

632636
if self.message.rows_limit != 0:

packages/google-cloud-bigtable/tests/unit/test_row_data.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,10 @@ def test_RRRM_build_updated_request(rrrm_data):
893893
row_filter = RowSampleFilter(0.33)
894894
last_scanned_key = b"row_key25"
895895
request = _ReadRowsRequestPB(
896-
filter=row_filter.to_pb(), rows_limit=8, table_name=TABLE_NAME
896+
filter=row_filter.to_pb(),
897+
rows_limit=8,
898+
table_name=TABLE_NAME,
899+
app_profile_id="app-profile-id-1",
897900
)
898901
request.rows.row_ranges.append(row_range1.get_range_kwargs())
899902

@@ -902,7 +905,10 @@ def test_RRRM_build_updated_request(rrrm_data):
902905
result = request_manager.build_updated_request()
903906

904907
expected_result = _ReadRowsRequestPB(
905-
table_name=TABLE_NAME, filter=row_filter.to_pb(), rows_limit=6
908+
table_name=TABLE_NAME,
909+
filter=row_filter.to_pb(),
910+
rows_limit=6,
911+
app_profile_id="app-profile-id-1",
906912
)
907913

908914
row_range1 = types.RowRange(

0 commit comments

Comments
 (0)