deriva.transfer.restore package¶
Submodules¶
deriva.transfer.restore.deriva_restore module¶
-
class
deriva.transfer.restore.deriva_restore.
DerivaRestore
(*args, **kwargs)[source]¶ Bases:
object
Restore a DERIVA catalog from a bag archive or directory. Core restore logic re-purposed from ErmrestCatalog.clone_catalog().
-
BASE_ASSETS_INPUT_PATH
= 'assets'¶
-
BASE_DATA_INPUT_PATH
= 'records/{}/{}.json'¶
-
RESTORE_STATE_URL
= 'tag:isrd.isi.edu,2019:restore-status'¶
-
static
check_column_compatibility
(src, dst)[source]¶ Check compatibility of source and destination column definitions.
-
copy_tdef_core
(table)[source]¶ Copy table definition structure with conditional parts excluding fkeys.
-
open_json_stream_file
(table_path)[source]¶ Open a JSON-Stream file for reading, caller is responsible for closing.
-
restore
(**kwargs)[source]¶ Perform the catalog restore operation. The restore process is broken up into six phases:
- Pre-process the input path.
- If the input path is a file, it is assumed that it is a compressed archive file that can be extracted
into an input directory via a supported codec: tar,`tgz`,`bz2`, or zip. - If the input directory is a valid _bag_ directory structure, the bag will be materialized.
- The catalog schema will be restored first. The schema is restored from a ERMRest JSON schema document file.
The schema document file must be named catalog-schema.json and must appear at the root of the input directory. The restore process can be configured to exclude the restoration of an enumerated set both schema and tables.
- The catalog table data will be restored, if present. The table date restoration process is resilient to
interruption and may be restarted. However, if the catalog schema or data is mutated outside of the scope of the restore function in-between such restarts, the restored catalog’s consistency cannot be guaranteed. The restore process can be configured to exclude the restoration of table data for a set of tables.
The catalog foreign keys will be restored.
The catalog assets will be restored, if present.
On success, the restore state marker annotations will be deleted and the catalog history will be truncated.
Parameters: kwargs – Returns:
-
deriva.transfer.restore.deriva_restore_cli module¶
-
class
deriva.transfer.restore.deriva_restore_cli.
DerivaRestoreCLI
(description, epilog, **kwargs)[source]¶ Bases:
deriva.core.base_cli.BaseCLI
Module contents¶
-
exception
deriva.transfer.restore.
DerivaRestoreConfigurationError
[source]¶ Bases:
ValueError
-
exception
deriva.transfer.restore.
DerivaRestoreError
[source]¶ Bases:
RuntimeError