> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/database-devops/3.0/use-db-devops/deployment-pipeline-configuration/step-types/update-sql.md).

# Update SQL Step

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.

{% hint style="info" %}
The Update SQL step is a Liquibase-only step. It is not available for Flyway migrations.
{% endhint %}

### Add the Update SQL step <a href="#add-the-update-sql-step" id="add-the-update-sql-step"></a>

1. In Harness, go to **Database DevOps** and select your project.
2. Open your pipeline and select the stage where you want to preview SQL.
3. Select **Add Step** and choose **Update SQL**.
4. Configure the step parameters described below.
5. Select **Apply Changes**, then save and run the pipeline.

### Step parameters <a href="#step-parameters" id="step-parameters"></a>

1. **Name** - Display name for the step. The step ID is derived from this name.
2. **Timeout** - Maximum duration before the step times out. Default is `10m`.
3. **Container Registry** - Select the container registry connector that Harness uses to pull the migration container.
4. **Select DB Schema** - Choose the DB Schema that holds your changelog and migration definitions.
5. **Select DB Instance** - Choose the DB Instance against which the SQL preview will be generated.

### Use the SQL output in downstream steps <a href="#use-the-sql-output-in-downstream-steps" id="use-the-sql-output-in-downstream-steps"></a>

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:

```
<+execution.steps.{stepGroupIdentifier}.steps.{stepIdentifier}.output.sqlCommands>
```

For example, if the step group is `stepGroup1` and the step identifier is `UpdateSQL_1`:

```
<+execution.steps.stepGroup1.steps.UpdateSQL_1.output.sqlCommands>
```

### Next steps <a href="#next-steps" id="next-steps"></a>

* Go to [Apply DB Schema step](/database-devops/use-db-devops/deployment-pipeline-configuration/step-types/apply-dbschema-step.md) to apply the reviewed changesets to your database instance.
* Go to [Using OPA with Database DevOps](/database-devops/3.0/use-db-devops/governance-and-compliance/using-opa-with-database-devops.md) to configure OPA policies that evaluate the generated SQL before deployment.
