Source code for django_snapshots.connectors.protocols

"""DatabaseConnector protocol definition."""

from __future__ import annotations

from pathlib import Path
from typing import Any, Protocol


[docs] class DatabaseConnector(Protocol): """Interface for dumping and restoring a single database alias."""
[docs] def dump(self, db_alias: str, dest: Path) -> dict[str, Any]: """Dump the database to *dest* and return artifact metadata.""" ...
[docs] def restore(self, db_alias: str, src: Path) -> None: """Restore the database from the dump file at *src*.""" ...