API Reference
pgclone
pgclone.copy
Copies a database using CREATE DATABASE <dump_key> TEMPLATE <database>
.
Note that we use dump keys with the same syntax that dump
and restore
commands take. Since copy
only works with local database copies, this
means the dump keys are always the database name prefixed with :
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dump_key |
str
|
A name to use for the copy. Must be prefixed with |
required |
database |
Union[str, None]
|
The database to copy. |
None
|
config |
Union[str, None]
|
The configuration name from |
None
|
Returns:
Type | Description |
---|---|
str
|
The dump key that was copied. |
Source code in pgclone/copy_cmd.py
pgclone.dump
dump(
*,
exclude: Union[List[str], None] = None,
pre_dump_hooks: Union[List[str], None] = None,
instance: Union[str, None] = None,
database: Union[str, None] = None,
storage_location: Union[str, None] = None,
config: Union[str, None] = None
) -> str
Dumps a database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
exclude |
Union[List[str], None]
|
The models to exclude when dumping the utils. |
None
|
pre_dump_hooks |
Union[List[str], None]
|
A list of management command names to run before dumping the utils. |
None
|
instance |
Union[str, None]
|
The instance name to use in the dump key. |
None
|
database |
Union[str, None]
|
The database to dump. |
None
|
storage_location |
Union[str, None]
|
The storage location to store dumps. |
None
|
config |
Union[str, None]
|
The configuration name from |
None
|
Returns:
Type | Description |
---|---|
str
|
The dump key associated with the database dump. |
Source code in pgclone/dump_cmd.py
pgclone.ls
ls(
dump_key: Union[str, None] = None,
*,
instances: bool = False,
databases: bool = False,
configs: bool = False,
local: bool = False,
database: Union[str, None] = None,
storage_location: Union[str, None] = None,
config: Union[str, None] = None
) -> List[str]
Lists dump keys.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dump_key |
Union[str, None]
|
Filter by this dump key prefix. |
None
|
instances |
bool
|
Lists only the unique instances associated with the dump keys. |
False
|
databases |
bool
|
Lists only the unique databases associated with the dump keys. |
False
|
configs |
bool
|
Lists only the unique configs associated with the dump keys. |
False
|
local |
bool
|
Only list local restore keys. |
False
|
database |
Union[str, None]
|
The database to restore. |
None
|
storage_location |
Union[str, None]
|
The storage location to use for the restore. |
None
|
config |
Union[str, None]
|
The configuration name from |
None
|
Returns:
Type | Description |
---|---|
List[str]
|
The list of dump keys. |
Source code in pgclone/ls_cmd.py
pgclone.restore
restore(
dump_key: Union[str, None] = None,
*,
pre_swap_hooks: Union[List[str], None] = None,
reversible: Union[bool, None] = None,
database: Union[str, None] = None,
storage_location: Union[str, None] = None,
config: Union[str, None] = None
) -> str
Restores a database dump.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dump_key |
Union[str, None]
|
Restores the specific dump key or the most recent dump matching the prefix. |
None
|
pre_swap_hooks |
Union[List[str], None]
|
The list of pre-swap hooks to run before swapping the temp restore database with the main utils. The strings are management command names. |
None
|
reversible |
Union[bool, None]
|
True if the dump can be reversed. |
None
|
database |
Union[str, None]
|
The database to restore. |
None
|
storage_location |
Union[str, None]
|
The storage location to use for the restore. |
None
|
config |
Union[str, None]
|
The configuration name from |
None
|
Returns:
Type | Description |
---|---|
str
|
The dump key that was restored. |