Skip to content

Commit

Permalink
fix: Pass app_profile_id when building updated request (#512)
Browse files Browse the repository at this point in the history
- Pass the app_profile_id from the message
- Update unittest

Fixes internal bug #214449800
  • Loading branch information
Mariatta committed Feb 24, 2022
1 parent 8ba7b59 commit 2f8ba7a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions google/cloud/bigtable/row_data.py
Expand Up @@ -624,9 +624,13 @@ def __init__(self, message, last_scanned_key, rows_read_so_far):

def build_updated_request(self):
"""Updates the given message request as per last scanned key"""

# TODO: Generalize this to ensure fields don't get rewritten when retrying the request

r_kwargs = {
"table_name": self.message.table_name,
"filter": self.message.filter,
"app_profile_id": self.message.app_profile_id,
}

if self.message.rows_limit != 0:
Expand Down
10 changes: 8 additions & 2 deletions tests/unit/test_row_data.py
Expand Up @@ -893,7 +893,10 @@ def test_RRRM_build_updated_request(rrrm_data):
row_filter = RowSampleFilter(0.33)
last_scanned_key = b"row_key25"
request = _ReadRowsRequestPB(
filter=row_filter.to_pb(), rows_limit=8, table_name=TABLE_NAME
filter=row_filter.to_pb(),
rows_limit=8,
table_name=TABLE_NAME,
app_profile_id="app-profile-id-1",
)
request.rows.row_ranges.append(row_range1.get_range_kwargs())

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

expected_result = _ReadRowsRequestPB(
table_name=TABLE_NAME, filter=row_filter.to_pb(), rows_limit=6
table_name=TABLE_NAME,
filter=row_filter.to_pb(),
rows_limit=6,
app_profile_id="app-profile-id-1",
)

row_range1 = types.RowRange(
Expand Down

0 comments on commit 2f8ba7a

Please sign in to comment.