Skip to content

Validate SQL statements created with postgresql-simple's quasiquoter

License

Notifications You must be signed in to change notification settings

joncfoo/postgresql-simple-query-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

postgresql-simple-query-validator

Validate SQL statements embedded in postgresql-simple's quasiquoter against a PostgreSQL server.

Why this exists

So I don't have to wait till an integration test or run-time to figure out whether a query I wrote or modified is valid (syntax and structure).

Also, swapping '?'s and actual data is a pain.

No more SQL syntax errors or incorrect column/table names in source code :)

Requirements

Usage

./validateSql.hs src/App/Queries.hs postgresql://user:password@host/dbname

Errors, if any, will be printed to stdout and the exit code will be non-zero.

Other usage

  • integrate this into your build so that it fails if there is a bad query
  • watch for source changes with entr, run this script, and send a notification accordingly with notify-send

About

Validate SQL statements created with postgresql-simple's quasiquoter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published