Run a MySQL query
Run a SQL query against a MySQL database with the mysql client, using a password read from a Kubernetes Secret.
Install v1.0.2
Installs the template into your Argo namespace. The URL is pinned to this version.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/mysql-query/1.0.2/template.yaml
Or with the Argo CLI:
argo template create -n argo https://catalog.dagweave.com/api/v1/items/mysql-query/1.0.2/template.yaml
Facts
- Category
- Databases
- Tags
- databases mysql
- Entrypoint
query- Template SHA-256
910f3e69acd73feb875bf8ca1b42632bf017b55d9794101da14152e40561cb60- Source
- mysql-query at catalog commit 67458f7
- API
- item document, latest template.yaml
Images and provenance
Every image is pinned by digest, so a rebuilt tag can never change what this version runs.
| Repository | Tag | Digest |
|---|---|---|
mysql | 8 | sha256:a0225d1ea6631c8bc2385dc4c2faba17bbf1834ecf369e1659a9a382bd8d5dd7 |
Parameters
| Name | Description | Default |
|---|---|---|
database required |
Database name to connect to. | none |
host required |
MySQL server host. Example db.internal |
none |
query required |
The SQL query to run. Example SELECT count(*) FROM orders; |
none |
user required |
User to authenticate as. | none |
password-secret-key |
Key within the Secret that holds the password. | password |
password-secret-name |
Name of the Kubernetes Secret holding the user's password. | mysql-password |
port |
MySQL server port. | 3306 |
WorkflowTemplate
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: mysql-query
labels:
dagweave.io/catalog-item: mysql-query
annotations:
# The catalog semver this manifest was authored at. The dagweave app records
# (catalog-item-id, semver) -> content-hash -> base-vN when it mints the tenant
# cluster name via ResolveOrMint. Keep in sync with metadata.yaml `version`.
dagweave.io/catalog-version: "1.0.2"
dagweave.io/catalog-category: "Databases"
spec:
entrypoint: query
templates:
- name: query
inputs:
parameters:
# The SQL query to run.
- name: query
# MySQL server host.
- name: host
# MySQL server port.
- name: port
default: "3306"
# Database name to connect to.
- name: database
# User to authenticate as.
- name: user
# Name of the Kubernetes Secret holding the user's password. Defaults let a
# user leave them blank in the Inspector.
- name: password-secret-name
default: mysql-password
- name: password-secret-key
default: password
container:
# Pinned by digest per the catalog convention: an image rebuild can never
# silently change the behaviour of an already-released item version.
# mysql:8
image: mysql@sha256:a0225d1ea6631c8bc2385dc4c2faba17bbf1834ecf369e1659a9a382bd8d5dd7
command: [sh, -c]
# Connection values and the query are passed as env vars (below), never
# interpolated into the shell, so a query containing quotes or shell
# metacharacters is safe. The mysql client reads the password from MYSQL_PWD,
# so it never appears on the command line.
args:
- |
set -eu
mysql -h "$DB_HOST" -P "$DB_PORT" -u "$DB_USER" -e "$QUERY" "$DB_NAME"
env:
- name: DB_HOST
value: "{{inputs.parameters.host}}"
- name: DB_PORT
value: "{{inputs.parameters.port}}"
- name: DB_NAME
value: "{{inputs.parameters.database}}"
- name: DB_USER
value: "{{inputs.parameters.user}}"
- name: QUERY
value: "{{inputs.parameters.query}}"
- name: MYSQL_PWD
valueFrom:
secretKeyRef:
name: "{{inputs.parameters.password-secret-name}}"
key: "{{inputs.parameters.password-secret-key}}"
Version history
Read from the item's changelog. Each version has its own JSON document; the pinned catalogue vendors the manifest of the latest one, so that is the version that installs.
-
1.0.2 latest 2026-10-19
Repin mysql:8 on the tag's current digest. What is still open against it is recorded in hack/image-cve-exceptions.txt. Same tool, same arguments; nothing about what the step runs changes.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/mysql-query/1.0.2/template.yamlargo template create -n argo https://catalog.dagweave.com/api/v1/items/mysql-query/1.0.2/template.yaml -
1.0.1 2026-08-02
Repin mysql:8 on the current digest. Same tag, newer build. Fixable CRITICAL/HIGH drops from 22 to 19.
This release is documented, but its manifest is not vendored here, so it has no install command. Version document
-
1.0.0 2026-07-17
Initial release.
This release is documented, but its manifest is not vendored here, so it has no install command. Version document
Run it once
After installing, from the command line.
argo submit -n argo --from workflowtemplate/mysql-query \
-p database=... \
-p host=db.internal \
-p query='SELECT count(*) FROM orders;' \
-p user=...
Workflow that references it
A Workflow with the required parameters filled from the examples.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: mysql-query-
spec:
workflowTemplateRef:
name: mysql-query
arguments:
parameters:
- name: database
value: "..."
- name: host
value: "db.internal"
- name: query
value: "SELECT count(*) FROM orders;"
- name: user
value: "..."
As a step of a larger workflow
steps:
- - name: mysql-query
templateRef:
name: mysql-query
template: query