GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: support row_range in sample_row_keys method by anvitTawar · Pull Request #17330 · googleapis/google-cloud-python

Conversation

@anvitTawar

@anvitTawar anvitTawar commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #17329

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

axyjo reacted with hooray emoji gemini-code-assist[bot] reacted with eyes emoji
All reactions
  • 🎉 1 reaction
  • 👀 1 reaction
anvitTawar added 2 commits May 29, 2026 03:59
@anvitTawar
feat: support row_range in sample_row_keys method
505921e
@anvitTawar
feat: update sample_row_keys docstrings and unit tests
5c89eb0
- In Table.sample_row_keys, updated the docstring to clarify that the end key of the provided row range is always returned as the last sample (or empty string if no range is specified), and updated the offset_bytes description to specify it includes preceding rows but after the last sample before the range.
- In async and sync unit tests, updated the mocked SampleRowKeys stream responses to use realistic keys falling inside the RowRange bounds (e.g. b"a_key1" and b"b"), and updated the key/length assertions accordingly.
- Reverted manual GAPIC type patches to let OwlBot/Librarian auto-patching handle the API class fields natively upon proto submission.

TAG=agy
CONV=6cea44b5-6adb-45c6-b8c8-58b37f95584c
@anvitTawar
anvitTawar requested a review from a team as a code owner June 1, 2026 21:43
gemini-code-assist[bot]
gemini-code-assist Bot reviewed Jun 1, 2026
View reviewed changes

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

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

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 adds support for a row_range parameter in the sample_row_keys method across the asynchronous, synchronous autogenerated, and legacy Bigtable clients, allowing users to restrict sampled row keys to a specific range. It also updates the test proxy handlers and adds corresponding unit tests. The review feedback highlights a potential bug in client_handler_legacy.py where an empty byte string b"" could be incorrectly treated as falsy when resolving range keys. Additionally, it suggests encapsulating None checks within helper functions and using explicit is not None checks instead of truthiness checks for optional parameters.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/google-cloud-bigtable/test_proxy/handlers/client_handler_legacy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/google-cloud-bigtable/test_proxy/handlers/client_handler_data_async.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/google-cloud-bigtable/test_proxy/handlers/client_handler_data_sync_autogen.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/google-cloud-bigtable/google/cloud/bigtable/data/_async/client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/google-cloud-bigtable/google/cloud/bigtable/data/_sync_autogen/client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@anvitTawar anvitTawar changed the title Sample row keys row range feat: support row_range in sample_row_keys method Jun 1, 2026
mutianf
mutianf approved these changes Jun 2, 2026
View reviewed changes
mutianf
mutianf reviewed Jun 2, 2026
View reviewed changes
Comment thread packages/google-cloud-bigtable/google/cloud/bigtable/table.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@anvitTawar
revert: remove legacy client changes for row_range in sample_row_keys
ce74362
Reverts the recently implemented row_range support from the legacy client code to keep it scoped cleanly to modern clients only:
- Reverted Table.sample_row_keys signature, docstrings, and implementation in google/cloud/bigtable/table.py.
- Reverted row_range parameter parsing in legacy test proxy client handler.
- Removed unit test test_table_sample_row_keys_w_row_range in tests/unit/v2_client/test_table.py.

TAG=agy
CONV=6cea44b5-6adb-45c6-b8c8-58b37f95584c
@anvitTawar
anvitTawar force-pushed the sample-row-keys-row-range branch from d6fe742 to ce74362 Compare June 2, 2026 18:12
anvitTawar added 2 commits June 2, 2026 18:23
@anvitTawar
fix: use explicit is not None check for row_range in client
3cd73e8
Updates the row_range check in both async and sync clients to use an explicit `is not None` check rather than truthiness evaluation.

TAG=agy
CONV=6cea44b5-6adb-45c6-b8c8-58b37f95584c
@anvitTawar
revert: discard formatting-only changes in legacy table module
738dceb
Restores packages/google-cloud-bigtable/google/cloud/bigtable/table.py and packages/google-cloud-bigtable/tests/unit/v2_client/test_table.py back to their original main branch states to eliminate redundant diffs from the PR.

TAG=agy
CONV=6cea44b5-6adb-45c6-b8c8-58b37f95584c
@anvitTawar
anvitTawar force-pushed the sample-row-keys-row-range branch from d5d20f8 to f1fd7a2 Compare June 2, 2026 19:40
@anvitTawar
style: format async client and tests with ruff 0.14.14
bcada0e
Applies `ruff format` using matching version 0.14.14 to resolve style failures on the PR, ensuring only minimal necessary style corrections are made.

TAG=agy
CONV=6cea44b5-6adb-45c6-b8c8-58b37f95584c
@anvitTawar
anvitTawar force-pushed the sample-row-keys-row-range branch from f1fd7a2 to bcada0e Compare June 2, 2026 19:44
@daniel-sanche

daniel-sanche commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for putting this together

  1. Can you add a system test, like this?
  2. I don't think changing the conformance tests should be required for this test. Were the tests failing before your changes?
  3. Let me know if you need help getting the other tests passing
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@daniel-sanche daniel-sanche added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jun 4, 2026
anvitTawar added 3 commits June 9, 2026 15:00
@anvitTawar
Merge branch 'main' of upstream into sample-row-keys-row-range
72d1192
@anvitTawar
test: add system test for SampleRowKeys row_range parameter
65f9b97
@anvitTawar
test: correct assertion in SampleRowKeys row_range system test
d21dc09
@anvitTawar

anvitTawar commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author
  1. Can you add a system test, like this?

Done.

  1. I don't think changing the conformance tests should be required for this test. Were the tests failing before your changes?

The tests were failing because the API proto change used by this feature wasn't published yet. Now that that's live, the tests have all passed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anvitTawar anvitTawar removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jun 9, 2026
@anvitTawar
anvitTawar merged commit 384724c into googleapis:main Jun 9, 2026
29 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@release-please release-please Bot mentioned this pull request Jun 17, 2026
chore(main): release google-cloud-bigtable 2.39.0 #17497
Merged
parthea pushed a commit that referenced this pull request Jun 22, 2026
@release-please
chore(main): release google-cloud-bigtable 2.39.0 (#17497)
f6937b3
🤖 I have created a release *beep* *boop*
---


##
[2.39.0](google-cloud-bigtable-v2.38.0...google-cloud-bigtable-v2.39.0)
(2026-06-22)


### Features

* added client side metric instrumentation to read_rows and mutate_rows
([#16758](#16758))
([4005e66](4005e66))
* **bigtable:** add client side metric instrumentation to basic rpcs
([#16712](#16712))
([636af26](636af26))
* **bigtable:** add view_parameters support to execute_query
([#17382](#17382))
([2695aad](2695aad))
* support row_range in sample_row_keys method
([#17330](#17330))
([384724c](384724c)),
closes
[#17329](#17329)
* update API sources and regenerate
([#17431](#17431))
([2e75c78](2e75c78))
* update googleapis and regenerate
([33ba3af](33ba3af))


### Bug Fixes

* **bigtable:** ensure deadline is respected for read_rows_sharded
([#17352](#17352))
([6cc890b](6cc890b))
* require Python 3.10+
([#17245](#17245))
([200b0d3](200b0d3))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
chalmerlowe pushed a commit that referenced this pull request Jun 25, 2026
@anvitTawar @chalmerlowe
feat: support row_range in sample_row_keys method (#17330)
d08f73e
Thank you for opening a Pull Request! Before submitting your PR, there
are a few things you can do to make sure it goes smoothly:
- [x] Make sure to open an issue as a
[bug/issue](https://github.com/googleapis/google-cloud-python/issues)
before writing your code! That way we can discuss the change, evaluate
designs, and agree on the general idea
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [x] Appropriate docs were updated (if necessary)

Fixes #17329
chalmerlowe pushed a commit that referenced this pull request Jun 25, 2026
@release-please @chalmerlowe
chore(main): release google-cloud-bigtable 2.39.0 (#17497)
d39095b
🤖 I have created a release *beep* *boop*
---


##
[2.39.0](google-cloud-bigtable-v2.38.0...google-cloud-bigtable-v2.39.0)
(2026-06-22)


### Features

* added client side metric instrumentation to read_rows and mutate_rows
([#16758](#16758))
([4005e66](4005e66))
* **bigtable:** add client side metric instrumentation to basic rpcs
([#16712](#16712))
([636af26](636af26))
* **bigtable:** add view_parameters support to execute_query
([#17382](#17382))
([2695aad](2695aad))
* support row_range in sample_row_keys method
([#17330](#17330))
([384724c](384724c)),
closes
[#17329](#17329)
* update API sources and regenerate
([#17431](#17431))
([2e75c78](2e75c78))
* update googleapis and regenerate
([33ba3af](33ba3af))


### Bug Fixes

* **bigtable:** ensure deadline is respected for read_rows_sharded
([#17352](#17352))
([6cc890b](6cc890b))
* require Python 3.10+
([#17245](#17245))
([200b0d3](200b0d3))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
@release-please release-please Bot mentioned this pull request Jul 15, 2026
chore(main): release google-cloud-bigtable 0.1.0 #17719
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mutianf mutianf mutianf approved these changes
+1 more reviewer
@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Implement specifying a row_range for sample_row_keys()

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@anvitTawar @daniel-sanche @mutianf
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.