openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

Add a sql linter to pre-commit

Open cdrini opened this issue 5 months ago • 1 comments

Feature Request

Problem / Opportunity

We had a ~1y period where new folks trying to initialize the open library repo likely couldn't because of syntax error (missing semicolon 🙃 ) in our .sql files. Having a basic sql linter run in pre-commit would help prevent issues like these. Note since the postgres container caches its initialization logic, no one who regularly develops OL saw this issue.

See https://github.com/internetarchive/openlibrary/pull/10979

Proposal

sqlfluff seems like an option: https://docs.sqlfluff.com/en/latest/production/pre_commit.html

Breakdown

Related files

Refer to this map of common Endpoints: *

Requirements Checklist

Checklist of requirements that need to be satisfied in order for this issue to be closed:

  • [ ]

Stakeholders


Instructions for Contributors

cdrini avatar Jul 03 '25 18:07 cdrini

I am a new contributor and I would like to help with this issue. Could you please assign it to me?

bettercallok avatar Dec 11 '25 12:12 bettercallok