Package¶
-
pgclone.
dump
(exclude_models=None, dump_config_name=None, pre_dump_hooks=None)[source]¶ Dumps a database copy
Output location for the dump is determined by
settings.PGCLONE_STORAGE_LOCATION
- Parameters
exclude_models (List[str], default=None) – The models to exclude when dumping the database.
dump_config_name (str, default=None) – The dump configuration name from
settings.PGCLONE_DUMP_CONFIGS
. Defaults todefault
pre_dump_hooks (List[str], default=None) – A list of management command names to run before dumping the database.
- Returns
The dump key associated with the database dump.
- Return type
-
pgclone.
ls
(db_name=None, only_db_names=False, local=False)[source]¶ Lists dump keys.
- Parameters
- Returns
The list of dump keys (or database names).
- Return type
List[str]
-
pgclone.
restore
(db_name_or_dump_key, pre_swap_hooks=None, restore_config_name=None, reversible=False)[source]¶ Restores a database dump
- Parameters
db_name_or_dump_key (str) – When a database name is provided, finds the most recent dump for that database and restores it. Restores a specific dump when a dump key is provided.
pre_swap_hooks (List[str], default=None) – The list of pre_swap hooks to run before swapping the temp restore database with the main database. The strings are management command names.
restore_config_name (str, default=None) – The name of the restore config to use when running the restore. Configured in settings.PGCLONE_RESTORE_CONFIGS
- Returns
The dump key that was restored.
- Return type