Skip to content

feat(spanner): Add sample listing copy-backup operations - #14866

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

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

Conversation

@iennae

@iennae iennae commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Description

Monitoring copy-backup progress on a destination instance requires filtering list_backup_operations on CopyBackupMetadata, which previously had C# and Ruby tabs without a Python sample.

Adds spanner_list_copy_backup_operations.

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

Monitoring in-flight backup copies on a destination instance requires filtering ListBackupOperationsRequest by CopyBackupMetadata.
@iennae
iennae requested review from a team as code owners November 17, 2026 23:48
@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 17, 2026
@snippet-bot

snippet-bot Bot commented Nov 17, 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

@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 script list_copy_backup_operations.py and its corresponding tests to list copy-backup operations on a destination Spanner instance. The feedback suggests a more idiomatic approach to deserialize the backup metadata by using CopyBackupMetadata.deserialize instead of accessing the underlying protobuf class.

Comment on lines +54 to +56
meta = spanner_admin_database_v1.CopyBackupMetadata.pb().FromString(
op.metadata.value
)

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.

medium

Using spanner_admin_database_v1.CopyBackupMetadata.deserialize(op.metadata.value) is more idiomatic and cleaner than accessing the underlying protobuf class via .pb() and calling .FromString() when working with proto-plus messages.

Suggested change
meta = spanner_admin_database_v1.CopyBackupMetadata.pb().FromString(
op.metadata.value
)
meta = spanner_admin_database_v1.CopyBackupMetadata.deserialize(
op.metadata.value
)

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.

Thanks! This comment refers to an earlier revision of this file; the code here has since been reworked in later commits, so this thread no longer applies to the current diff.

Deserializes operation metadata via proto-plus CopyBackupMetadata.deserialize and prints short backup and instance IDs without project identifiers.
@amcolin
amcolin self-requested a review November 19, 2026 18:51
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.

2 participants