Is there any linter for vsql scripts?

We would like to extend our CI/CD pipeline with running validation/linting of sql scripts during the authoring process. We found no good solution for this yet.

What I did so far

While DataGrip from JetBrains has support for the Vertica dialect, that is an IDE not a solution for CI/CD.
Contacted Vertica Support, they suggested to ask this question here.
I did a bit of googling, and found a curated list of linters, but no turn key solutions for vertica:

What we need

An open source solution would be better, but a subscription based/proprietary one would also be great.
I'm kinda surprised that there is no official Vertica solution for this.
Any suggestions? Thanks!


  • Options
    VValdarVValdar Vertica Employee Employee

    Hi vhermecz,

    That's the goal of an open source project, if you need it and it doesn't exist you can contribute :)

    On a personal note, I never saw a single benefit from a SQL linter.
    I really don't want my code or indentation to be supervised by rules made by someone else.

    Why do you want a linter?

  • Options

    An obvious helpful use case for linting is to automate catching syntax errors (formatting aside).

    Typically, linting can configure formatting rules, so a team can decide which formatting rules to enforce (if any).

  • Options
    Bryan_HBryan_H Vertica Employee Administrator

    What type of validation do you need? If you want to check quickly whether a SQL is valid, then EXPLAIN <sql>; is a quick check that will usually tell you whether the SQL is valid, in which case it returns a plan, or invalid, in which case it returns an error that may indicate what's wrong, e.g.:

    demo=> explain select foo;
    ERROR 2624:  Column "foo" does not exist
  • Options

    Planned usage:
    We had multiple cases where broken sql submitted to production caused ETL to fail, causing tiny outages.
    Automatic linting (not formatting, just error checking) could have caught these earlier, before reaching prod.

    Thx Bryan, the EXPLAIN <sql>; is a great trick, already applying that in some parts of our UI.
    I'm assuming it requires a server and thus feels a bit heavy weight for CI.
    Also wondering if it could handle variables it the queries (probably nope).

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file