Updated : 2026-03-27
Abstract base class for database backup handlers. Each
database type (MariaDB, PostgreSQL, MongoDB, etc.)
implements this interface.
| Method | Required | Description |
|---|---|---|
dump() |
Yes | Dump database to file(s), return paths |
list_databases() |
Yes | List available databases/buckets |
get_database_size() |
No | Estimate size in bytes (default: 0) |
system_databases |
No | Tuple of DBs to exclude from discovery |
| Method | Description |
|---|---|
compress() |
7z compression of output files |
cleanup() |
Remove intermediate files/directories |
run_cli_with_progress() |
Run CLI with Rich progress bar |
run_cli_to_dir() |
Run CLI that outputs to a directory |
from ObjBackupRegistry import ObjBackupRegistry
from ObjBackupHandler import ObjBackupHandler
@ObjBackupRegistry.register("NEWDB")
class ObjBackupDumpNewdb(ObjBackupHandler):
def dump(self, build_folder, database,
connection_config):
# Your dump logic here
return [output_file_path]
def list_databases(self, connection_config):
return ["db1", "db2"]
Then add the side-effect import in ObjBackup.py.
Handlers receive a dict from config.yaml with keys
varying by database type:
| Key | MariaDB | Postgres | Mongo | InfluxDB |
|---|---|---|---|---|
| host | Yes | Yes | Yes | Yes |
| user | Yes | Yes | username | - |
| password | Yes | Yes | Yes | - |
| port | - | 5432 | 27017 | 8086 |
| db | Yes | Yes | data | - |
| ssl | - | Yes | - | - |
| token | - | - | - | Yes |
| org | - | - | - | Yes |
| url | - | - | - | Cloud |
Updated : 2026-03-27