#script #sql #dry #tool #cli-tool #dry-run #file

app dry_sql

CLI tool to dry-run your SQL scripts

4 releases

0.1.4 May 9, 2024
0.1.3 May 9, 2024
0.1.2 Apr 27, 2024
0.1.1 Apr 27, 2024

#266 in Database interfaces

Download history 270/week @ 2024-04-25 16/week @ 2024-05-02 239/week @ 2024-05-09 6/week @ 2024-05-16 2/week @ 2024-05-23

137 downloads per month


112 lines


CLI tool to dry run your SQL scripts


This tool was created when I was setting up some database migrations stuffs in the CI pipeline that was supposed to be executed on another environment. The migration should be applied on main branch. It's mandatory that specific migrations in a the pull request get successfully applied before the app is deployed.

If the team practices DB migrations strictly, then the presence of migration issues would be minimalized or nihilized. However,developers are human after all. Some migrations scripts some times failed to execute due to some human errors. Hence, there is a need to validate the migration scripts which are SQL scripts without committing them.

While some SQL script linter have benefits to check for SQL statement for errors, they don't validate whether your scripts would be successfully executed. There are several reasons why a SQL script might fail to execute even if it passes the linter:

  • Data-related Issues: The script may encounter unexpected data conditions or constraints during execution that were not accounted for in the linting process.
  • Database Schema Changes: If the database schema changes after the linting process, the script may no longer be compatible with the updated schema.

Use case example

The most common use case would be obviously to validate migration SQL scripts in the pipeline :). Of course, you can use it to mimick your SQL scripts anywhere else.

How to Use

On the terminal:

if you want to dry-run a SQL file.

dry_sql --host <host> --port <port> --user <username> --password <password> --file <path/to/your/sql/script>

if you want to dry-run multiple a SQL inside a folder.

dry_sql --host <host> --port <port> --user <username> --password <password> --dir <path/to/your/sql/script/foder>


Currently, this tool only support Postgres SQL. The rest will be coming along.


Written in Rust.


~270K SLoC