Rewrite of #288, whose core premise was incorrect: there is no CopyDatabase RPC in the Spanner Database Admin API (verified against cloud.google.com/go/spanner v1.91.0 databasepb — only CopyBackup exists), so the statement set proposed there cannot be implemented as designed.
Viable designs
- Backup/restore chaining:
CreateBackup → RestoreDatabase (+ optional CopyBackup for cross-instance). Both are LROs, so progress display can reuse the existing ShowOperationStatement / operation-listing patterns (statements.go). Restrictions apply (same instance config family, retention limits).
- DUMP-based copy: export through the existing DUMP pipeline (statements_dump.go) and replay into the target database. Slower, but works across configs and to the emulator.
A minimal first statement could be COPY DATABASE <src> TO <dst> implementing strategy 1 only, with strategy 2 as a follow-up or an explicit option.
References
Rewrite of #288, whose core premise was incorrect: there is no
CopyDatabaseRPC in the Spanner Database Admin API (verified against cloud.google.com/go/spanner v1.91.0databasepb— onlyCopyBackupexists), so the statement set proposed there cannot be implemented as designed.Viable designs
CreateBackup→RestoreDatabase(+ optionalCopyBackupfor cross-instance). Both are LROs, so progress display can reuse the existingShowOperationStatement/ operation-listing patterns (statements.go). Restrictions apply (same instance config family, retention limits).A minimal first statement could be
COPY DATABASE <src> TO <dst>implementing strategy 1 only, with strategy 2 as a follow-up or an explicit option.References
SHOW BACKUPSetc. would share the ListBackups plumbing)