Skip to main content

backups

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

Overview​

Namebackups
TypeResource
Idclickhouse.backups.backups

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstring (uuid)Unique backup ID.
service_idstringName (wire: serviceId)
backup_namestringBackup name on the external backup bucket. (wire: backupName)
bucketobjectBackup bucket where the backup is stored.
duration_in_secondsnumberTime in seconds it took to perform the backup. If the status still in_progress, this is the time in seconds since the backup started until now. (wire: durationInSeconds)
finished_atstring (date-time)Backup finish timestamp. ISO-8601. Available only for finished backups (wire: finishedAt)
size_in_bytesnumberSize of the backup in bytes. (wire: sizeInBytes)
started_atstring (date-time)Backup start timestamp. ISO-8601. (wire: startedAt)
statusstringStatus of the backup: 'done', 'error', 'in_progress'. (done, error, in_progress)
typestringBackup type ("full" or "incremental"). (full, incremental)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectservice_id, backup_id, organization_idReturns a single backup info.
listselectservice_id, organization_idReturns a list of all backups for the service. The most recent backups comes first in the list.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
backup_idstring (uuid)ID of the requested backup. (wire: backupId)
organization_idstringClickHouse Cloud organization ID. Resolved from the CLICKHOUSE_ORG_ID environment variable when it is set (x-stackQL-envVar); otherwise it must be supplied on every query as WHERE organization_id = <uuid>. A WHERE value always takes precedence over the environment. (x-stackQL-envVar: CLICKHOUSE_ORG_ID)
service_idstring (uuid)ID of the service the backup was created from. (wire: serviceId)

SELECT examples​

Returns a single backup info.

SELECT
id,
service_id,
backup_name,
bucket,
duration_in_seconds,
finished_at,
size_in_bytes,
started_at,
status,
type
FROM clickhouse.backups.backups
WHERE service_id = '{{ service_id }}' -- required
AND backup_id = '{{ backup_id }}' -- required
AND organization_id = '{{ organization_id }}' -- required unless CLICKHOUSE_ORG_ID is set
;