PoC: database with MariaDB¶
Checks whether MariaDB fits AREA's data: users, workflows with a variable number of nodes,
deduplicated hook events and stored OAuth tokens. It serves the persistence selection document.
This PoC and pocs/database-postgresql/ reach the same target, so the two can be compared.
- Author: Esteban
- Date: 2026-11-26
- Timebox: 45 minutes
- Why this timebox: the same for both database PoCs; long enough to start a database in Docker and run a short script, short enough to leave time for the selection document before the Plan defense.
- Time actually spent: not tracked
- Stack: MariaDB 11.4 in Docker Compose, Python, MariaDB Connector/Python (
mariadb), Fernet
Target¶
- The database starts with
docker compose up, with its data kept in a named volume - The connection string is read from the
DATABASE_URLenvironment variable, not hard-coded in the source - A schema for users, workflows, workflow nodes and processed hook events
- A script saves one user and one workflow with a trigger, a condition and 4 reactions, then reads the nodes back in order; nothing in the model limits the number of reactions to 4
- Saving the same hook event twice (same subscription, same external ID) is rejected by the database
- After
docker compose downthenup(without-v), the data is still there - An OAuth token is stored encrypted, not in clear text (bonus; application code uses Fernet and stores ciphertext)
Where I was when the time ran out¶
The Compose service, named volume, schema and demo script are implemented. Docker checks passed for
startup, duplicate rejection and persistence. The end-to-end Python demo could not be run here:
installing mariadb from pip requires the MariaDB Connector/C development package (mariadb_config),
which is not installed in this environment. The encryption code is present but was not runtime checked.
What took the most time¶
Not tracked. Installing the Python connector on this host also needs MariaDB Connector/C development headers and build tools.
What it would take to go further¶
Install MariaDB Connector/C development headers and build tools, run the Python demo, compare query ergonomics and schema changes with PostgreSQL, and decide key management and token rotation for a production design.
Running the PoC¶
cp .env.example .env
# Replace OAUTH_ENCRYPTION_KEY with the output of the command in .env.example.
set -a; . ./.env; set +a
docker compose up -d
python -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt
python demo.py
docker compose down
docker compose up -d
python demo.py
Install the host packages libmariadb-dev and build-essential before pip install if the
connector build reports that mariadb_config is missing. If port 3306 is occupied, set
MARIADB_PORT=3307 in .env and change the port in DATABASE_URL to 3307. The second run writes a
new uniquely named demo record and checks that the existing database is
reachable after the restart. Compose creates the schema on first initialization of the named volume.
Use docker compose down -v only when intentionally discarding the PoC database.
Evidence¶
docker compose up -d started MariaDB 11.4 and created database-mariadb_mariadb_data. MariaDB
listed all five schema tables. A direct second insert of an existing subscription/external ID failed
with error 1062 on uq_subscription_external_event. After docker compose down then up -d, a
query for that row returned 1, confirming persistence. The Python demo itself could not be run
because mariadb_config is absent; node ordering, four demo reactions and token encryption remain
to be confirmed through that script.
Impressions¶
The workflow model has no reaction-count limit: each node is a row keyed by workflow and position.
MariaDB's unique index directly enforces idempotent event ingestion. OAuth encryption is performed
in the application, so deployments must manage and rotate OAUTH_ENCRYPTION_KEY separately from
the database and its backups.