MySQL
appdb: driver: mysql dsn: mysql://reader:${MYSQL_PASSWORD}@mysql:3306/app?tls=preferred&parseTime=true allowed_users: [analysts] timeout: 30s| Parameter | Meaning |
|---|---|
tls | false, preferred (default for prod), skip-verify, true |
parseTime | parse DATE/DATETIME columns into Go time.Time (recommended true) |
loc | timezone for parsed times; default UTC |
Authentication
Section titled “Authentication”Read-only user with explicit grants on the views/tables PlotPress should reach:
CREATE USER 'plotpress_reader'@'%' IDENTIFIED BY '...';GRANT SELECT ON app.* TO 'plotpress_reader'@'%';FLUSH PRIVILEGES;Views (primary path)
Section titled “Views (primary path)”MySQL VIEWs and tables both work. PlotPress runs:
SELECT * FROM monthly_revenue WHERE year = ?Use ordinary CREATE VIEW for the business logic; reference by name in the Plot block.
Fallback: queries/*.sql
Section titled “Fallback: queries/*.sql”-- queries/monthly_revenue.sql-- @param year int default 2026
select date_format(invoice_date, '%Y-%m-01') as month, sum(amount) as revenue, currencyfrom invoiceswhere year(invoice_date) = :yeargroup by 1, 3order by 1;:name is rewritten to MySQL’s ? placeholder at execution.
Caveats
Section titled “Caveats”STRICT_ALL_TABLESis recommended on the server side; PlotPress assumes well-typed columns.utf8mb4for any text comparisons.ONLY_FULL_GROUP_BY(default in 8.x) catches sloppy aggregations early.information_schemaaccess. PlotPress probes column types viainformation_schema.columns; the read-only user needsSELECTon it (granted by default for*.*SELECT).