Dumper
This class is used to dump and restore a Postgres database.
Source code in pum/dumper.py
__init__
Initialize the Dumper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pg_connection
|
str
|
PostgreSQL service name or connection string. Can be a service name (e.g., 'mydb') or a full connection string (e.g., 'postgresql://user:pass@host/db' or 'host=localhost dbname=mydb'). |
required |
dump_path
|
str
|
Path where the dump file will be saved or loaded from. |
required |
Source code in pum/dumper.py
pg_dump
pg_dump(dbname: str | None = None, *, pg_dump_exe: str = 'pg_dump', exclude_schema: list[str] | None = None, format: DumpFormat = DumpFormat.CUSTOM)
Call the pg_dump command to dump a db backup
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dbname
|
str | None
|
Name of the database to dump. |
None
|
pg_dump_exe
|
str
|
Path to the pg_dump executable. |
'pg_dump'
|
exclude_schema
|
list[str] | None
|
List of schemas to exclude from the dump. |
None
|
format
|
DumpFormat
|
DumpFormat, either custom (default) or plain |
CUSTOM
|
Source code in pum/dumper.py
pg_restore
pg_restore(dbname: str | None = None, pg_restore_exe: str = 'pg_restore', exclude_schema: list[str] | None = None)