-
Notifications
You must be signed in to change notification settings - Fork 0
Database Backends
DomainRaptor stores scan history, watch targets and enrichment data in a relational database. SQLite is used by default, but PostgreSQL and MySQL are supported via SQLAlchemy + Alembic when you install the matching optional extras.
No configuration required. The database lives at
~/.domainraptor/domainraptor.db and is initialised on first use by
DatabaseManager. The legacy sqlite3-based repositories
(ScanRepository, WatchRepository) are used.
Set a SQLAlchemy URL via either:
- Environment variable:
DOMAINRAPTOR_DATABASE_URL=... - Config file (
~/.domainraptor/config.toml):database_url = "..."
When database_url is non-sqlite:, DomainRaptor switches to the SQLAlchemy
Core-backed SqlScanRepository / SqlWatchRepository automatically (via
domainraptor.storage.get_scan_repository).
Install the extra:
pip install "domainraptor[postgres]"Example URL:
database_url = "postgresql+psycopg://user:password@localhost:5432/domainraptor"Install the extra:
pip install "domainraptor[mysql]"Example URL:
database_url = "mysql+pymysql://user:password@localhost:3306/domainraptor"Schema changes are managed with Alembic. The repository ships with a baseline migration that mirrors the legacy schema version 3.
# Apply all pending migrations against the configured DB
PYTHONPATH=src alembic upgrade head
# Inspect the current revision
PYTHONPATH=src alembic current
# Autogenerate a new revision after editing storage/_metadata.py
PYTHONPATH=src alembic revision --autogenerate -m "describe change"The URL is resolved with this priority:
-
-x url=...Alembic CLI argument -
DOMAINRAPTOR_DATABASE_URLenvironment variable -
sqlalchemy.urlinalembic.ini(left blank by default) -
AppConfig.resolve_database_url()from the user's config
For non-SQLite engines, DomainRaptor enables pool_pre_ping, a base pool size
of 5 and max_overflow=10. These defaults are conservative; tune them per
deployment by passing your own URL with ?pool_size=...&max_overflow=...
query parameters (SQLAlchemy reads them automatically).
For SQLite, check_same_thread=False is enabled so the orchestrator's
ThreadPoolExecutor can share a single connection without raising.
- The legacy
DatabaseManagermigration ladder (v1 → v3) is SQLite-only. Non-SQLite users must runalembic upgrade headonce before first use (theget_scan_repository/get_watch_repositoryfactories do this automatically viainit_schema()for fresh databases). - Cross-dialect ON DELETE CASCADE behaviour is emulated in
SqlScanRepository.delete()by deleting child rows explicitly before the parent scan row.
DomainRaptor v0.2.0 | GitHub | Report Issue | MIT License