Update SQL Step
Configure the Update SQL step in a Harness Database DevOps pipeline to preview the SQL that would be applied to a database without executing it, for validation and policy enforcement before deployment
The Update SQL step generates the SQL statements that would be applied to a target database from your Liquibase changelog, without executing them. It is used for validation, auditing, and policy enforcement before a deployment runs. The generated SQL is surfaced in the Harness UI and can be referenced in downstream approval gates and OPA policy steps.
Add the Update SQL step
In Harness, go to Database DevOps and select your project.
Open your pipeline and select the stage where you want to preview SQL.
Select Add Step and choose Update SQL.
Configure the step parameters described below.
Select Apply Changes, then save and run the pipeline.
Step parameters
Name - Display name for the step. The step ID is derived from this name.
Timeout - Maximum duration before the step times out. Default is
10m.Container Registry - Select the container registry connector that Harness uses to pull the migration container.
Select DB Schema - Choose the DB Schema that holds your changelog and migration definitions.
Select DB Instance - Choose the DB Instance against which the SQL preview will be generated.
Use the SQL output in downstream steps
The generated SQL is available as a step output expression. Use this to pass the preview SQL into an approval gate or OPA policy step:
For example, if the step group is stepGroup1 and the step identifier is UpdateSQL_1:
Next steps
Go to Apply DB Schema step to apply the reviewed changesets to your database instance.
Go to Using OPA with Database DevOps to configure OPA policies that evaluate the generated SQL before deployment.
Last updated
Was this helpful?