Releases: Introducing Runbooks
This release (v1.2+) introduces runbooks, which are templates that could be run against a connection runtime. With this release, any client could build input types based on a template obtained from a git source.
# fetch-customer.runbook.sql
SELECT firstname, lastname FROM customers
WHERE customerid = {{ .customer_id | squote }}
When this template is run against a connection, it will be rendered replacing the placeholders. Below there's an example of how to execute it:
POST /api/plugins/runbooks/connections/pg-prod/exec
{
"file_name": "get-customer.runbook.sql",
"parameters": {"customer_id": "1040"}
}
- The execution will render the following input
SELECT firstname, lastname FROM customers
WHERE customerid = '1040'
- If this is connection is a command line type and run against a postgres client like psql, what will happen when executing this runbook is:
psql (...) <<EOF
SELECT firstname, lastname FROM customers
WHERE customerid = '1040'
EOF
Check it out our documentation for more information.