aimbat.db
Database engine for the AIMBAT project file.
The engine is created from Settings.db_url (see aimbat._config), which
defaults to a SQLite database at aimbat.db in the current working directory.
The path can be overridden via environment variable or .env file:
AIMBAT_PROJECT=/path/to/project.db # derives db_url automatically
AIMBAT_DB_URL=sqlite+pysqlite:///absolute/path/to/project.db # explicit override
For SQLite connections, PRAGMA foreign_keys=ON is set automatically on every
new connection to enforce referential integrity.
Attributes:
| Name | Type | Description |
|---|---|---|
engine |
AIMBAT database engine. |
engine
module-attribute
engine = create_engine(
url=db_url,
echo=False,
connect_args={"check_same_thread": False, "timeout": 30}
if "sqlite" in db_url
else {},
)
AIMBAT database engine.
set_sqlite_pragma
set_sqlite_pragma(
dbapi_connection: Connection,
connection_record: ConnectionPoolEntry,
) -> None
Enable specific PRAGMAs for each new SQLite connection.