Skip to content

docs(bigtable): add samples for sync client - #17820

Merged
daniel-sanche merged 2 commits into
mainfrom
samples_2_add_sync_samples
Oct 30, 2026
Merged

daniel-sanche merged 2 commits into
mainfrom
samples_2_add_sync_samples

Conversation

@daniel-sanche

@daniel-sanche daniel-sanche commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Some samples are still implemented in the legacy client only. This PR implements them in the data or admin clients, and adds a suffix to the region tags for the legacy client

@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 adds new Python samples and tests for the Google Cloud Bigtable admin and data clients, while updating legacy client samples with _legacy region tags. The review feedback highlights several critical API usage issues in the new data client snippets, including incorrect attribute access on Row and Cell objects, the use of the non-existent DeleteRangeFromColumn class (which should be DeleteCells), and type mismatches where regex filters expect bytes instead of strings (or vice-versa). Additionally, the feedback suggests minor cleanups for unused imports, unused variables, and redundant fully qualified imports.

Base automatically changed from samples_1_reorganize_samples to main August 12, 2026 01:55
@daniel-sanche
daniel-sanche added this pull request to stack #18598 October 7, 2026 22:05
@daniel-sanche
daniel-sanche removed this pull request from stack #18598 October 7, 2026 23:47
@daniel-sanche
daniel-sanche changed the base branch from main to samples_1_run_tests October 7, 2026 23:48
@daniel-sanche
daniel-sanche added this pull request to stack #18600 October 7, 2026 23:48
Base automatically changed from samples_1_run_tests to main October 17, 2026 11:49
@daniel-sanche daniel-sanche changed the title [DRAFT] chore(bigtable): add samples for sync client docs(bigtable): add samples for sync client Oct 26, 2026
@daniel-sanche
daniel-sanche marked this pull request as ready for review October 26, 2026 23:44
@daniel-sanche
daniel-sanche requested a review from a team as a code owner October 26, 2026 23:44
@snippet-bot

snippet-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 149 region tags.
You are about to delete 71 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@mutianf mutianf 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.

Do we need to keep the legacy/ samples? or we can remove them?

# [START bigtable_check_instance_exists]
from google.api_core.exceptions import NotFound

from google.cloud import bigtable_admin

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.

should we import from bigtable_admin_v2 to be clear that this is using the gapic generated client?

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.

bigtable_admin is the version-less alias for bigtable_admin_v2, which is what we usually point to in python sdk samples.

But I agree the clients are kind of confusing here, so if you think having _v2 makes things clearer, that works for me. Let me know

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.

Yeah, maybe add the _V2

@@ -0,0 +1,2 @@
google-cloud-bigtable

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.

do we need a minimum version? (after gapic generated client is released?)

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.

We shouldn't need one, because the expectation is that bigtable is installed at HEAD. But I'll make the change in case anyone wants to run against the libraries manually

print(
"Command should be either run or delete.\n Use argument -h,\
--help to show help and exit."
)

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.

should we add example for restore_table and wait_for_consistency (since those are overlays)?

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.

Good idea, added

Although the other samples are being imported into devsite samples, and these only live here in the repo for now

@daniel-sanche

Copy link
Copy Markdown
Contributor Author

Do we need to keep the legacy/ samples? or we can remove them?

I was thinking we could keep them here in the repo, in case we need to link to them later. But the plan is to remove them from the public docs

@daniel-sanche
daniel-sanche force-pushed the samples_2_add_sync_samples branch from fb1b2bc to d62d731 Compare October 30, 2026 01:00
Add samples for the clients that replace the deprecated
`google.cloud.bigtable.Client`:

- samples/data_client: synchronous data samples (hello, quickstart,
  reads/writes/filters/deletes snippets) using BigtableDataClient
- samples/admin_client: instance, table and metric-scaler admin samples
  using the generated BigtableInstanceAdminClient / BigtableTableAdminClient,
  including the overlay-only wait_for_consistency, create_backup and
  restore_table operations

The new sync samples take over the canonical region tags; the legacy client
samples are renamed to `*_legacy` and kept as tested references. The async
samples drop their dependency on the legacy client for table administration,
and the shared test utilities provision tables through the admin client.
@daniel-sanche
daniel-sanche force-pushed the samples_2_add_sync_samples branch from d62d731 to 2746ed3 Compare October 30, 2026 17:46
@daniel-sanche
daniel-sanche merged commit 72e5f48 into main Oct 30, 2026
57 checks passed
@daniel-sanche
daniel-sanche deleted the samples_2_add_sync_samples branch October 30, 2026 19:06
daniel-sanche added a commit that referenced this pull request Oct 30, 2026
Some samples are still implemented in the legacy client only. This PR
implements them in the data or admin clients, and adds a suffix to the
region tags for the legacy client
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.

2 participants