-
Notifications
You must be signed in to change notification settings - Fork 614
[FEATURE][DB]: MariaDB support testing and documentation #288
Copy link
Copy link
Labels
devopsDevOps activities (containers, automation, deployment, makefiles, etc)DevOps activities (containers, automation, deployment, makefiles, etc)enhancementNew feature or requestNew feature or requesthelmHelm chartHelm chartpythonPython / backend development (FastAPI)Python / backend development (FastAPI)
Milestone
Description
🧭 Epic - MariaDB Support (alongside PostgreSQL & SQLite)
| Field | Value |
|---|---|
| Title | Add full MariaDB 10.6+ compatibility (runtime, migrations, CI, docs) |
| Goal | Run the Gateway with a MariaDB backend simply by changing the SQLAlchemy URL (e.g., mariadb+mariadbconnector://…). Provide a one-liner Docker Compose service, optional Helm values, green CI matrix, and updated docs. |
| Why now | Several downstream teams operate on MariaDB-only clusters. Supporting it widens adoption and lets us validate SQL-dialect abstractions before 1.0 GA. |
| Depends on | Alembic migration framework; Validation & Schema Enforcement epic (cross-dialect JSON handling). |
This feature validates that SQLAlchemy and Alembic migrations are implemented correctly, and provides an additional baseline to compare performance with.
🧭 Type of Feature
- Database portability
- DevOps / CI
- Documentation
🙋♂️ User Stories
| # | Persona | Need | Acceptance Criteria |
|---|---|---|---|
| 1 | Platform engineer | Spin up Gateway + MariaDB in Docker Compose | docker compose -f docker-compose.mariadb.yml up starts Gateway, Alembic auto-migrates, health checks pass. |
| 2 | SRE running Helm | Deploy Gateway with cluster-managed MariaDB | Setting db.type=mariadb in values.yaml generates a valid Secret & connection string; pods reach Ready. |
| 3 | Developer | CI asserts my PR works on all DBs | GitHub Actions job shows ✨ green for sqlite / postgres / mariadb matrix. |
| 4 | Doc reader | Find config & caveats in docs | README & “Databases” guide list supported engines, connection URLs, engine-specific notes. |
🔧 Task Breakdown
-
SQLAlchemy & Drivers
- Pin
mariadb>=1.1.4(connector) inrequirements.in. - Update
config.pyto acceptDB_DRIVERenv var default →mariadb+mariadbconnector.
- Pin
-
Alembic Dialect Support
- Add MariaDB branch in
alembic/env.py(engine.dialect.name == "mariadb"). - Replace
postgresql.UUID→String(36)if dialect is MariaDB. - Migrate JSONB →
JSONtype; fallback toTEXTfor 10.3-.
- Add MariaDB branch in
-
Schema Fix-ups
- Shorten FK names (
<= 64 chars) vianaming_conventionfor MariaDB. - Replace
ARRAYcolumns with comma-separatedVARCHARor link-table.
- Shorten FK names (
-
Test Matrix
- GitHub Actions matrix
{ DB: sqlite, postgres, mariadb }. - GitHub Service container:
mariadb:10.6, envMARIADB_ROOT_PASSWORD: test. - Parametrise
pytestfixture to spin engine per DB.
- GitHub Actions matrix
-
Docker Compose
-
docker-compose.mariadb.ymladds:mariadb: image: mariadb:10.6 environment: MARIADB_ROOT_PASSWORD: gateway ports: ["3306:3306"]
-
Gateway service gets
DB_URL: mariadb+mariadbconnector://root:gateway@mariadb:3306/gateway.
-
-
Helm Chart
-
values.yaml→db: type: mariadb # postgres|sqlite|mariadb host: mariadb port: 3306 user: gateway password: gateway
-
Conditional template renders
driverClassName, liveness query.
-
-
Documentation
- “Supported Databases” page: sample URLs, limitations (no partial
JSONPathindex, FK length). - README quick-start snippet for Compose & Helm.
- “Supported Databases” page: sample URLs, limitations (no partial
-
Migration Guide
- Doc section: “Migrating Postgres → MariaDB” (export/import with
mysqldumpcaveats).
- Doc section: “Migrating Postgres → MariaDB” (export/import with
-
Observability
- DB metrics labels include
engine="mariadb".
- DB metrics labels include
-
Release Notes & Changelog
- Note new driver dependency and env vars.
📓 Implementation Notes / Caveats
- JSON – MariaDB ≥10.5 stores JSON as LONGTEXT with type validation; no JSONB indexing.
- UUIDs – stored as
CHAR(36); minor perf hit vs nativeuuidin Postgres. - Transactions – default engine
InnoDB; tests enforceREAD COMMITTEDisolation. - Max key length – 3072 bytes (utf8mb4) ⇒ watch composite indexes.
🔄 Alternatives Considered
| Approach | Pros | Cons | Decision |
|---|---|---|---|
| Stick to Postgres only | Less code, best features | Blocks teams on MariaDB, reduces adoption | ❌ |
✅ Definition of Done
- All unit & integration tests pass on sqlite-latest, postgres-16, mariadb-10.6 in CI.
docker compose -f docker-compose.mariadb.yml upstarts without manual tweaks.- Helm chart with
db.type=mariadbdeploys successfully on kind.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
devopsDevOps activities (containers, automation, deployment, makefiles, etc)DevOps activities (containers, automation, deployment, makefiles, etc)enhancementNew feature or requestNew feature or requesthelmHelm chartHelm chartpythonPython / backend development (FastAPI)Python / backend development (FastAPI)