Skip to content

feat(spanner): Add RestoreDatabase from backup sample - #14977

Open
iennae wants to merge 2 commits into
feat/spanner-copy-backupfrom
feat/spanner-restore-backup
Open

iennae wants to merge 2 commits into
feat/spanner-copy-backupfrom
feat/spanner-restore-backup

Conversation

@iennae

@iennae iennae commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Description

Adds spanner_restore_backup restoring a Spanner backup into a new database via DatabaseAdminClient.restore_database.

Note: Stacked on #14854 (feat/spanner-copy-backup) so this PR shows only this sample's diff. It will merge into main after #14854.

Checklist

Testing

  • I have tested this change on a live environment and verified it works as intended. Unit and live integration tests pass on Python 3.13.

Compliance & Style


Post-Approval Actions

  • Please merge this PR for me once it is approved

Disaster-recovery guides restore a Spanner backup into a new database via DatabaseAdminClient.restore_database. Add a standalone spanner_restore_backup sample with unit and live tests.
@iennae
iennae requested review from a team as code owners November 18, 2026 22:19
@snippet-bot

snippet-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 1 region tag.

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

@product-auto-label product-auto-label Bot added api: spanner Issues related to the Spanner API. samples Issues that are directly related to samples. labels Nov 18, 2026

@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 introduces a new utility script to restore a Google Cloud Spanner database from a backup, along with a corresponding suite of unit and integration tests. The implementation includes error handling for common API exceptions and a CLI entry point for ease of use. I have no feedback to provide as there were no review comments submitted for this pull request.

Problem: review of this sample identified correctness and robustness
improvements in the sample and its tests.

Solution: apply the accepted review suggestions and extend the tests to
cover the updated behavior. Details are in the review thread replies.

Files updated:
  - spanner/backups/tests/restore_backup_test.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the Spanner API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant