Docs / How-to guides / Back up and restore
How-to guide For operators

Back up and restore

The control plane — every product, decision and the audit log — is one SQLite file. Back it up like one.

Before you start

  • Know the path: var/dpf.sqlite3 by default, or wherever DPF_DB points — see Configuration.
  • Somewhere to write the copy to. The commands below write a second file; they do not snapshot in place.

Steps

Online, while the service runs — SQLite's own backup command copies a consistent snapshot even while something is writing to it:

sqlite3 var/dpf.sqlite3 ".backup /path/to/dpf-$(date +%F).sqlite3"

Offline, with the service stopped — a plain file copy is safe once nothing is writing:

sudo systemctl stop dataproductfactory
cp var/dpf.sqlite3 /path/to/dpf-$(date +%F).sqlite3
sudo systemctl start dataproductfactory

The warehouse needs neither. var/warehouse.duckdb is disposable — rebuild it byte-identical from the same seed:

.venv/bin/python -m dpf load

A Databricks warehouse is the customer's: it is backed up the way they back up the rest of their lakehouse, not by this application.

Restore

sudo systemctl stop dataproductfactory
cp /path/to/dpf-2026-10-04.sqlite3 var/dpf.sqlite3
sudo systemctl start dataproductfactory

Warning

A restore loses every event recorded after the backup was taken — every decision, every signature, every promotion — and the audit log cannot be merged back in: it is append-only by design, and there is no second copy to reconcile it against. Take the backup as close to the restore as you can, and tell whoever approved anything in the gap that it is gone.

Check that it worked

  • The app answers, and systemctl is-active dataproductfactory says active.
  • The products and audit log you expect are there — spot-check one recent decision.

If it does not work

  • database is locked during a plain copy. The service was still running — use the online .backup command instead, or stop it first.
  • The restored file opens but recent work is missing. That is the gap between the backup and the restore, not a corrupt file — see the warning above.
Documentation for version 0.2.0 Reviewed 2026-10-19 Covers dpf/db.py