Skip to content

MySQL

appdb:
driver: mysql
dsn: mysql://reader:${MYSQL_PASSWORD}@mysql:3306/app?tls=preferred&parseTime=true
allowed_users: [analysts]
timeout: 30s
ParameterMeaning
tlsfalse, preferred (default for prod), skip-verify, true
parseTimeparse DATE/DATETIME columns into Go time.Time (recommended true)
loctimezone for parsed times; default UTC

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;

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.

-- queries/monthly_revenue.sql
-- @param year int default 2026
select
date_format(invoice_date, '%Y-%m-01') as month,
sum(amount) as revenue,
currency
from invoices
where year(invoice_date) = :year
group by 1, 3
order by 1;

:name is rewritten to MySQL’s ? placeholder at execution.

  • STRICT_ALL_TABLES is recommended on the server side; PlotPress assumes well-typed columns.
  • utf8mb4 for any text comparisons.
  • ONLY_FULL_GROUP_BY (default in 8.x) catches sloppy aggregations early.
  • information_schema access. PlotPress probes column types via information_schema.columns; the read-only user needs SELECT on it (granted by default for *.* SELECT).