Skip to main content

database_dumps

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

Overview​

Namedatabase_dumps
TypeResource
Idovh.hosting_web.database_dumps

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idintegerDump id
task_idintegerThe task ID working on this dump (wire: taskId)
creation_datestring (date-time)Creation date of the dump (wire: creationDate)
deletion_datestring (date-time)Automatic deletion date of the dump (wire: deletionDate)
statusstringThe dump status (created, creating, deleting)
typestringDump type (daily.1, now, weekly.1)
urlstringDump url access

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectid, name, service_nameGet a database dump. Returns the status, type, download URL and automatic deletion date of the dump. The type tells whether it comes from the current database or from a daily or weekly backup.
listselectname, service_namecreation_date.from, creation_date.to, deletion_date.from, deletion_date.to, type, x_pagination_modeList database dumps. Returns the IDs of the dumps of the database. Filter them by creation or deletion date.
createinsertname, service_name, dateCreate a database dump. Creates a dump of the current database or of a daily or weekly backup, and returns the task. An email is sent when the dump is ready, unless sendEmail is false.
deletedeleteid, name, service_nameDelete a database dump. Deletes the dump before its automatic deletion date and returns the task. Otherwise, the dump is deleted on that date.
restoreexecid, name, serviceNameRestore a database dump. Restores the dump into the database and returns the task. The current content of the database is replaced by the dump.

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
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
idintegerDump id
namestringDatabase name (like mydb.mysql.db or mydb.postgres.db)
serviceNamestringThe internal name of your hosting
service_namestringThe internal name of your hosting (wire: serviceName)
creation_date.fromstring (date-time)Filter the value of creationDate property (>=) (wire: creationDate.from)
creation_date.tostring (date-time)Filter the value of creationDate property (<=) (wire: creationDate.to)
deletion_date.fromstring (date-time)Filter the value of deletionDate property (>=) (wire: deletionDate.from)
deletion_date.tostring (date-time)Filter the value of deletionDate property (<=) (wire: deletionDate.to)
typestringFilter the value of type property (=)
x_pagination_modestringSent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode)

SELECT examples​

Get a database dump. Returns the status, type, download URL and automatic deletion date of the dump. The type tells whether it comes from the current database or from a daily or weekly backup.

SELECT
id,
task_id,
creation_date,
deletion_date,
status,
type,
url
FROM ovh.hosting_web.database_dumps
WHERE id = '{{ id }}' -- required
AND name = '{{ name }}' -- required
AND service_name = '{{ service_name }}' -- required
;

INSERT examples​

Create a database dump. Creates a dump of the current database or of a daily or weekly backup, and returns the task. An email is sent when the dump is ready, unless sendEmail is false.

INSERT INTO ovh.hosting_web.database_dumps (
date,
send_email,
name,
service_name
)
SELECT
'{{ date }}' /* required */,
{{ send_email }},
'{{ name }}',
'{{ service_name }}'
RETURNING
id,
object_id,
done_date,
function,
last_update,
object_type,
start_date,
status
;

DELETE examples​

Delete a database dump. Deletes the dump before its automatic deletion date and returns the task. Otherwise, the dump is deleted on that date.

DELETE FROM ovh.hosting_web.database_dumps
WHERE id = '{{ id }}' --required
AND name = '{{ name }}' --required
AND service_name = '{{ service_name }}' --required
;

Lifecycle Methods​

EXEC variables use wire (API) names.

Restore a database dump. Restores the dump into the database and returns the task. The current content of the database is replaced by the dump.

EXEC ovh.hosting_web.database_dumps.restore
@id='{{ id }}' --required,
@name='{{ name }}' --required,
@serviceName='{{ serviceName }}' --required
;