Restores database objects from a backup accessible via the data source specified by input parameter datasource_name.
Parameters
Name of the backup to restore from, which must refer to an existing backup. The default value is ‘’.
Map of database objects to be restored from the backup. Allowed keys are:
all – All object types and data contained in the given schema(s).
catalog – Data Lake catalog that is external to the database.
context – Context(s).
credential – Credential(s).
datasink – Data sink(s).
datasource – Data source(s).
directory – KiFS File directory(ies).
function_environment – Python UDF function environment(s).
graph – Graph definition(s). Source table(s), if applicable, are required in order to restore graph objects.
monitor – Table monitor(s) / SQL stream(s).
resource_group – Resource group(s).
role – Role(s), role members (roles or users, recursively), and associated permissions.
stored_procedure – SQL procedure(s).
table – Table(s) and SQL view(s). Tables with subscriptions will by default be restored in the state they were in at the time of the snapshot. See restore_subscriptions for options to override the default behavior.
user – User(s) (internal and external) and associated permissions.
user_defined_function – UDF(s).
Data source through which the backup will be restored.
Optional parameters. Allowed keys are:
backup_id – ID of the snapshot to restore. Leave empty to restore the most recent snapshot in the backup. The default value is ‘’.
checksum – Whether or not to verify checksums for backup files when restoring. Allowed values are:
true
false
The default value is ‘false’.
create_schema_if_not_exist – Behavior to apply when the schema containing any database object to restore does not already exist. Allowed values are:
true – If the schema containing any restored object does not exist, create it automatically.
false – If the schema containing any restored object does not exist, return an error.
The default value is ‘true’.
ddl_only – Behavior to apply when restoring tables. Allowed values are:
true – Restore table DDL, but do not restore data.
false – Restore tables and their data.
The default value is ‘false’.
dry_run – Whether or not to perform a dry run of the restoration operation. Allowed values are:
true
false
The default value is ‘false’.
restore_subscriptions – Behavior to apply when restoring datasource subscriptions on tables. Allowed values are:
resume – Resume subscriptions that were active when the backup was made.
pause – Pause subscriptions that were active when the backup was made.
cancel – Cancel active subscriptions.
The default value is ‘resume’.
reingest – Behavior to apply when restoring table data. Allowed values are:
true – Restore table data by re-ingesting it. This is the default behavior if the cluster topology differs from that of the contained backup.
false – Restore the persisted data files directly.
The default value is ‘false’.
renamed_objects_schema – If the restore_policy is rename, use this schema for relocated existing objects instead of the default generated one. The default value is ‘’.
restore_all_permissions – Whether or not all permissions of restored principals should be restored or scoped to the restored objects. Allowed values are:
true – Restore all permissions.
false – Restore only permissions on restored objects.
The default value is ‘false’.
restore_policy – Behavior to apply when any database object to restore already exists. Allowed values are:
none – If an object to be restored already exists with the same name, abort and return error.
replace – If an object to be restored already exists with the same name, replace it with the backup version.
rename – If an object to be restored already exists with the same name, move that existing one to the schema specified by renamed_objects_schema. This policy does not apply to non-schema objects.
The default value is ‘none’.
target_schema_map – Restore schema-based objects to alternate schema. Value is a comma delimitted list of key:value pairs mapping the original (source) schema name as it exists in the backup to a target (destination) schema namespace: “src: dst [, src: dst [, …]]”. Note that schema names are case sensitive and must adhere to the database schema naming criteria. The default value is ‘’.
The default value is an empty dict ( ).
Returns
A dict with the following entries–
Value of input parameter backup_name.
ID of the snapshot that was restored.
Total size of data restored from backup.
Total number of files restored from backup.
Total number of records restored from backup.
Database objects that were successfully restored and their associated types.
Original and new names of database objects that were successfully restored and their associated types.
Database objects that failed to be restored and their associated types.
Additional information.