MariaDB DAL
MariaDB DAL
Read references/specification.md, references/classification.md, references/engineering-contract.md and references/health-checks.md. Do not modify the canonical manager.
- Copy
assets/DbMgr.pybyte-for-byte into<app>/interface/DbMgr.py. The marker isbmforge.db-serverspec0.5.0. All consuming apps using this spec have the same generic file. - Resolve connection configuration outside the manager in the application, then inject those values. Do not insert application constants or configuration-file parsing into
DbMgr. - Build only needed application-owned domain interfaces, such as
VisitorDborMiningDb, at<app>/interface/<Name>Db.py. Each composes aDbMgr, owns its own SQL and transactions, and never connects with PyMySQL independently. - Activities call named domain interface operations and entities carry records. SQL never goes in activities, entities, HTTP or ZMQ transport modules.
- The health operation uses the application’s configured connection, not a direct CMDB connection to MariaDB.
- Inspect pinned examples
references/source/bmgeoip/.../GeoIpDb.pyandreferences/source/mycount/.../VisitDb.pyonly for the domain-interface pattern. Do not copy their schema or business logic. - Test parameters, transactions/rollback, per-worker resource lifetime and health. No ORM or alternative database driver without approval.
- Pin
CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ciexplicitly in database and table DDL. Ordinary character columns inherit that table default or explicitly name the same pair; preserve MariaDB JSON’s type-defined binary collation as specified. The canonical manager pins the connection too. Audit effective database/table/column and connection settings, and test a cross-database text join withoutCOLLATEworkarounds. Database defaults do not convert existing columns: adoption by an existing app requires a reviewed upgrade and any necessary explicit migration, never automatic production changes.