webknossos icon indicating copy to clipboard operation
webknossos copied to clipboard

Add SQL Syntax Checker

Open fm3 opened this issue 1 year ago • 1 comments

Can we feed our scala sources into a tool like pgsanity or plpgsql lint to find some issues without actually executing the queries?

Hurdles:

  • extract the SQL statements from scala sources (q""-strings)
  • deal with $interpolation (those might not only be values but also parts of the query. can we just replace them by TRUE or something?)

fm3 avatar May 02 '24 06:05 fm3

My 5ct:

Parsing and looking for q"" should be possible with tree-sitter which also has scala support. Tree sitter makes it easily possible to query a file for q""-strings and from there we should be able to

  1. put it into a validator against our schema
  2. format the query string to support unified query string formatting

MichaelBuessemeyer avatar May 06 '24 09:05 MichaelBuessemeyer