Add the data source
- Insight → Data Sources → New, provider type SQL.
- Set the driver, host, database, user and (in the secret) the password. A read-only database user is strongly recommended.
- Define a metric map: for each metric give a name, a result type (scalar, list or timeseries) and the
SELECTthat returns it. The binds:date_from,:date_toand:limitare available so each query follows the time window selected on the dashboard. - Save then Test.
Safety
The client only runs a single read-only SELECT/WITH, caps rows, and applies a statement timeout - but a read-only database account remains the primary safeguard.