3

I am looking for an SQL validator / Syntax Checker which can be executed via CLI.

Must-haves:

  • Be able to check an SQL command for errors and return the error(s) if any
  • Executable on (locally, no web connection)

Nice to have:

  • Python interface, e.g. having a python function which can lint an SQL string
  • Allow different SQL dialects
  • Active developers
2
  • Are there any SQL dialects that are mandatory – like "must support Oracle and MySQL dialects"? Not that I have anything in mind – but wouldn't it be nasty if the one most important to you were missing? ;) Apart from that: +1 :)
    – Izzy
    Commented Jul 12, 2019 at 7:08
  • 1
    I'm not sure ... I use snowflake warehouse, mysql and postgres. But for this question, I would be fine with a validator which deals with standard SQL Commented Jul 12, 2019 at 8:20

2 Answers 2

2

As others have pointed out, my program sql-lint will do what you need.

It is open source, completely free and in active development. Linting a query is as simple as:

echo "DELETE FROM person;" | sql-lint

It will bring back errors from the SQL server and its own built-in ones.

Hope that helps, and good luck!

0

You might take a look at sql-lint: https://github.com/joereynolds/sql-lint

I don't have any personal experience with it, but it appears to meet your requirements for a command-line interface, error reporting, and support for both MySQL and Postgres.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.