docs: For restoreTable and garbage collection rules samples use the admin client, not the handwritten layer#1697
Merged
kevkim-codes merged 37 commits intomainfrom Sep 5, 2025
Merged
Conversation
This commit updates the `backups.restore.js` sample to use the `BigtableTableAdminClient` directly for restoring a table from a backup, instead of going through the handwritten `bigtable.instance().createTableFromBackup()` method. This change is based on the design document for the Node.js Bigtable Admin API autogeneration. The corresponding test for the sample in `samples/test/backups.js` has also been updated to pass the correct arguments to the updated sample script.
danieljbruce
commented
Aug 21, 2025
| await operation.promise(); | ||
| const [table] = await operation.promise(); | ||
|
|
||
| console.log(`Table restored to ${table.id} successfully.`); |
Contributor
Author
There was a problem hiding this comment.
This generated sample has been checked. The only thing we need to change is table.id to table.name.
danieljbruce
commented
Aug 21, 2025
| adminClient | ||
| .createTable(request) | ||
| .then(result => { | ||
| const newTable = result[0]; |
Contributor
Author
There was a problem hiding this comment.
I ran this. It works
instance of the admin client should be used
danieljbruce
commented
Aug 21, 2025
| }) | ||
| .then(result => { | ||
| const family = result[0]; | ||
| // const apiResponse = result[1]; |
Contributor
Author
There was a problem hiding this comment.
This snippet was changed manually to use the admin client
kevkim-codes
approved these changes
Aug 25, 2025
Contributor
|
I think our CI is broken because of the sample updates? |
Contributor
Author
Yeah. docs are expected to fail. And not all conformance tests are done so that's an expected failure too. |
Contributor
Author
|
Before I merge this I think we should just make sure the API surface is right for users that get the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
For all samples that exercise garbage collection rules or restoreTable on the generated layer, make sure those samples use the handwritten layer instead.
Impact
This meets the need of encouraging users to use the generated admin client by changing the samples. It also provides the GCRuleMaker so that users can build the rules to be included in requests with gc rules.
Testing
Samples tests still pass. All samples not included in the samples tests were checked manually in the examples folder.
Additional Information
Next steps:
BigtableTableAdminClientunder the hood to instead useBigtableTableAdminClientdirectly.