Project
A project is a single SQLite database file (aimbat.db by default) holding
everything AIMBAT knows about a dataset: events, stations, seismograms, their
processing parameters, and snapshots. All four interfaces read and write the
same project file.
Creating a project
A project must be initialised before data can be added. This creates the database schema in a new SQLite file.
Re-running project create on an existing project raises an error rather than
overwriting anything. create_project raises
RuntimeError for the same case.
Project location
By default, AIMBAT reads and writes aimbat.db in the current working
directory. The location only needs to be set once.
Keep the project on local storage
SQLite relies on POSIX file locking, which is not reliable over network
filesystems (NFS, SMB, and similar). A project database on a network share
can be corrupted. Keep aimbat.db on a local disk.
A different path
Set AIMBAT_PROJECT to any file path, for one command or a whole session:
A .env file
A .env file in the working directory is loaded automatically, with no
exporting:
This is the best option for persistent per-project configuration. Commit .env
alongside the project scripts so the path stays consistent.
A full database URL
For advanced setups, such as a non-default SQLite driver, set AIMBAT_DB_URL to
a full
SQLAlchemy URL.
It takes precedence over AIMBAT_PROJECT:
SQLite only
AIMBAT supports only sqlite-family URLs. A non-SQLite backend will not work
correctly even with a driver installed: the triggers that keep quality
metrics in sync with parameter changes are only ever created for SQLite, so
the database would come up without them and quality data would silently go
stale.
Precedence
Highest wins:
AIMBAT_DB_URLAIMBAT_PROJECTaimbat.dbin the current directory
Check what is in effect with aimbat utils settings, or
aimbat utils settings --no-pretty for KEY="value" output ready to paste into
.env.
Upgrading a project
AIMBAT changes the database schema between some releases. A project created by an older version, including one predating schema versioning, must be brought up to date:
Launch the TUI. A stale schema is caught on startup, before any panel that
might query a column the live schema doesn't have: a modal offers to
upgrade now (u or Enter) or quit.
This is safe to run at any time. It does nothing if the project is already current, and otherwise upgrades the schema without touching events, seismograms, parameters, or snapshots.
Until a project is upgraded, every other aimbat command refuses to run against
it: the CLI and shell report the error, and the TUI shows a blocking dialog.
The Python API differs: see
What every interface enforces.
Check the current schema version without upgrading:
The TUI has no equivalent command; it runs this same check automatically on startup and only surfaces it as the upgrade modal above.