> 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/use-db-devops/deployment-pipeline-configuration/step-types/liquibase-command-step/running-arbitrary-sql-commands.md).

# Execute Arbitrary SQL Commands

### Pre-requisites <a href="#pre-requisites" id="pre-requisites"></a>

* Liquibase command step is created. You can refer to the Harness documentation detailing how to [Add a Liquibase command step](/database-devops/use-db-devops/deployment-pipeline-configuration/step-types/liquibase-command-step/add-liquibase-command-step.md)

{% hint style="info" %}
**NOTE**

**Minimum versions**

* **drone-liquibase** - `plugins/drone-liquibase:1.1.0-4.27`
* **drone-liquibase-mongo** - `plugins/drone-liquibase:1.1.0-4.27-mongo`
* **drone-liquibase-spanner** - `plugins/drone-liquibase:1.1.0-4.27-spanner`
  {% endhint %}

### Overview <a href="#overview" id="overview"></a>

Using the LiquibaseCommand step we can execute arbitrary SQL commands using the execute-sql command. This allows users to define raw SQL, simplifying workflows that require direct SQL execution.

### Use Cases <a href="#use-cases" id="use-cases"></a>

This is useful when we to run a single SQL statement without creating a separate changelog file.

Examples include:

* Performing one-time data fixes
* Executing a quick schema modification
* Running DDL/DML queries during a deployment pipeline
* check the database data

### Pipeline Configuration <a href="#pipeline-configuration" id="pipeline-configuration"></a>

* The command value for LiquibaseCommand Step needs to be `execute-sql`
* `Exclude ChangeLog File` checkbox needs to checked
* The settings configuration will contain key as `sql` and value will contain the sql statement to execute

**The configuration in the pipeline will look like below**

![Execute SQL](/files/izPZAXRgziw73CEmvKEz)

**At the yaml level the configuration will look like below**

```yaml
type: LiquibaseCommand
spec:
  command: execute-sql
  settings:
    sql: SELECT * FROM PERSON;
```

{% hint style="info" %}
**NOTE**

The sql statement should not contain double quotes around it
{% endhint %}

### Conclusion <a href="#conclusion" id="conclusion"></a>

If everything is configured correctly, the step execution should look like below.

In the below example we are querying from `DATABASECHANGELOG` table where description is matching a certain value.

![](/files/ckxsehEkTSApnQOlPdyc)

### References <a href="#references" id="references"></a>

* [liquibase\_execute\_sql](https://docs.liquibase.com/commands/utility/execute-sql.html)

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

* Go to [Add a Liquibase command step](/database-devops/use-db-devops/deployment-pipeline-configuration/step-types/liquibase-command-step/add-liquibase-command-step.md) to learn how to add a Liquibase command step in your pipeline.
