Skip to main content

SQL Action

SQL action makes a SQL query on the provided database.

delete-check-statuses.yaml
apiVersion: mission-control.flanksource.com/v1
kind: Playbook
metadata:
name: delete-check-statuses
spec:
description: Deletes all the check statuses of a given check
checks:
- type: http
actions:
- name: Delete check statuses
sql:
connection: connection://Postgres/incident-commander
database: incident_commander
driver: postgres
query: DELETE FROM check_statuses WHERE check_id = {{.check.id}}
FieldDescriptionSchemeRequired
connectionConnection identifier e.g. connection://postgres/flanksource.string
urlURL is the database connection url.string
queryQuery is the sql query to run. It can also be templated. Read more ...stringtrue
driverDriver is the name of the underlying database to connect to. Example: postgres, mysql, ...stringtrue
note

Either the connection or the url is required.

Templating

The SQL query is templatable. The script template receives a environment variable that contain details about the corresponding config, check or component and the parameter(if applicable).

FieldDescriptionSchema
configConfig passed to the playbookConfigItem
componentComponent passed to the playbookComponent
checkCanary Check passed to the playbookCheck
paramsUser provided parameters to the playbookmap[string]string