Skip to main content

backup_schedules

Creates, updates, deletes, gets or lists a backup_schedules resource.

Overview

Namebackup_schedules
TypeResource
Idgoogle.spanner.backup_schedules

Fields

NameDatatypeDescription
namestringIdentifier. Output only for the CreateBackupSchedule operation. Required for the UpdateBackupSchedule operation. A globally unique identifier for the backup schedule which cannot be changed. Values are of the form projects//instances//databases//backupSchedules/a-z*[a-z0-9] The final segment of the name must be between 2 and 60 characters in length.
encryptionConfigobjectEncryption configuration for the backup to create.
fullBackupSpecobjectThe specification for full backups. A full backup stores the entire contents of the database at a given version time.
incrementalBackupSpecobjectThe specification for incremental backup chains. An incremental backup stores the delta of changes between a previous backup and the database contents at a given version time. An incremental backup chain consists of a full backup and zero or more successive incremental backups. The first backup created for an incremental backup chain is always a full backup.
retentionDurationstringOptional. The retention duration of a backup that must be at least 6 hours and at most 366 days. The backup is eligible to be automatically deleted once the retention period has elapsed.
specobjectDefines specifications of the backup schedule.
updateTimestringOutput only. The timestamp at which the schedule was last updated. If the schedule has never been updated, this field contains the timestamp when the schedule was first created.

Methods

NameAccessible byRequired ParamsDescription
projects_instances_databases_backup_schedules_getSELECTbackupSchedulesId, databasesId, instancesId, projectsIdGets backup schedule for the input schedule name.
projects_instances_databases_backup_schedules_listSELECTdatabasesId, instancesId, projectsIdLists all the backup schedules for the database.
projects_instances_databases_backup_schedules_createINSERTdatabasesId, instancesId, projectsIdCreates a new backup schedule.
projects_instances_databases_backup_schedules_deleteDELETEbackupSchedulesId, databasesId, instancesId, projectsIdDeletes a backup schedule.
projects_instances_databases_backup_schedules_patchUPDATEbackupSchedulesId, databasesId, instancesId, projectsIdUpdates a backup schedule.

SELECT examples

Lists all the backup schedules for the database.

SELECT
name,
encryptionConfig,
fullBackupSpec,
incrementalBackupSpec,
retentionDuration,
spec,
updateTime
FROM google.spanner.backup_schedules
WHERE databasesId = '{{ databasesId }}'
AND instancesId = '{{ instancesId }}'
AND projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new backup_schedules resource.

/*+ create */
INSERT INTO google.spanner.backup_schedules (
databasesId,
instancesId,
projectsId,
name,
spec,
retentionDuration,
encryptionConfig,
fullBackupSpec,
incrementalBackupSpec
)
SELECT
'{{ databasesId }}',
'{{ instancesId }}',
'{{ projectsId }}',
'{{ name }}',
'{{ spec }}',
'{{ retentionDuration }}',
'{{ encryptionConfig }}',
'{{ fullBackupSpec }}',
'{{ incrementalBackupSpec }}'
;

UPDATE example

Updates a backup_schedules resource.

/*+ update */
UPDATE google.spanner.backup_schedules
SET
name = '{{ name }}',
spec = '{{ spec }}',
retentionDuration = '{{ retentionDuration }}',
encryptionConfig = '{{ encryptionConfig }}',
fullBackupSpec = '{{ fullBackupSpec }}',
incrementalBackupSpec = '{{ incrementalBackupSpec }}'
WHERE
backupSchedulesId = '{{ backupSchedulesId }}'
AND databasesId = '{{ databasesId }}'
AND instancesId = '{{ instancesId }}'
AND projectsId = '{{ projectsId }}';

DELETE example

Deletes the specified backup_schedules resource.

/*+ delete */
DELETE FROM google.spanner.backup_schedules
WHERE backupSchedulesId = '{{ backupSchedulesId }}'
AND databasesId = '{{ databasesId }}'
AND instancesId = '{{ instancesId }}'
AND projectsId = '{{ projectsId }}';