Skip to content

feat: Rerouted ReadRows to data client - #18198

Open
daniel-sanche wants to merge 7 commits into
shim/10-read-rows-rst-streamfrom
shim/11-read-rows-data-client
Open

feat: Rerouted ReadRows to data client#18198
daniel-sanche wants to merge 7 commits into
shim/10-read-rows-rst-streamfrom
shim/11-read-rows-data-client

Conversation

@daniel-sanche

@daniel-sanche daniel-sanche commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Migrating over @gkevinzheng PR from bigtable monorepo googleapis/python-bigtable#1299

Original description:

Changes Made:

  • Added methods to convert Row and Cell objects in the data client to PartialRowData and Cell objects in the legacy client.
  • Removed legacy client code related to processing ReadRowResponse chunks and testing ReadRowResponse chunks.
  • Removed _update_message_request from RowSet because it's no longer needed to create a ReadRowQuery
  • Rerouted read_row and read_rows to use their data client counterparts in table.py.

Additional Changes:

Applied some guards against removed semi-private APIs, after internal discussion:

  • 6941199: we had a couple technically public, but not meant to be accessed attributes. This commit replaces them with properties that raise a warning and return None, rather than completely removing them
  • c9617ac: Similarily, the PartialRowsData constructor was technically public, but not intended to be used. This change returns an empty generator when the previous constructor is used, with a warning
  • b51292e: handles a bug that could occur if None is passed for retries
  • 92da437: added better typing to generator

Note to reviewers: This PR has already been reviewed and merged to a staging branch, with the intention of doing a single merge to main. We are now planning to slowly rollout these changes back to the main branch. Minimal re-review should be necessary

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the Bigtable client to delegate row reading and streaming to the underlying _table_impl data client, deprecating legacy classes like _RowMerger and several attributes on PartialRowsData. The review feedback identifies potential AttributeError risks when accessing retry.deadline directly (since google.api_core.retry.Retry typically uses _deadline internally) in table.py and unit tests, as well as when calling close() on _generator in row_data.py if the generator does not support it.

Comment thread packages/google-cloud-bigtable/google/cloud/bigtable/table.py Outdated
Comment thread packages/google-cloud-bigtable/google/cloud/bigtable/table.py Outdated
Comment thread packages/google-cloud-bigtable/google/cloud/bigtable/row_data.py
Comment thread packages/google-cloud-bigtable/tests/unit/v2_client/test_table.py
@daniel-sanche
daniel-sanche force-pushed the shim/11-read-rows-data-client branch from 92da437 to e435179 Compare September 2, 2026 18:42
@daniel-sanche
daniel-sanche marked this pull request as ready for review September 2, 2026 22:09
@daniel-sanche
daniel-sanche requested a review from a team as a code owner September 2, 2026 22:09

self.rows = {}
@property
def last_scanned_row_key(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this property was only used in the internal method? Would it actually be called? Is it safe to just remove it?

Same question with read_method and retry, and request

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were technically public attributes before, even though they weren't advertised. Hopefully they aren't used, but I thought the safer choice would be to raise a warning and return None when they are accessed, instead of letting the program raise an AttributeError

:type row_key: bytes
:param row_key: The key of the row to read from.

:type filter_: :class:`.RowFilter`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we rewrite the RowFilter class?

@daniel-sanche daniel-sanche Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The data client originally duplicated the row_filter file, with a few small changes to some of the classes. The shim deleted the original row_filter file, and aliases in the data client classes instead (with a few patches to make sure the API is consistent)

@daniel-sanche
daniel-sanche force-pushed the shim/11-read-rows-data-client branch from b8af700 to ce411c0 Compare September 4, 2026 22:17
gkevinzheng and others added 6 commits September 4, 2026 15:21
**Changes Made:**
- Added methods to convert `Row` and `Cell` objects in the data client
to `PartialRowData` and `Cell` objects in the legacy client.
- Removed legacy client code related to processing `ReadRowResponse`
chunks and testing `ReadRowResponse` chunks.
- Removed `_update_message_request` from `RowSet` because it's no longer
needed to create a `ReadRowQuery`
- Rerouted `read_row` and `read_rows` to use their data client
counterparts in `table.py`.
@daniel-sanche
daniel-sanche force-pushed the shim/11-read-rows-data-client branch from ce411c0 to dad8a76 Compare September 4, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants