Eg. some people like to align the clauses vertically and use a leading, not trailing, comma.
select a
, b
, count(*) as count
from table
where cond1
and cond2
group by a, b
order by count desc11–20 of 95 posts
Eg. some people like to align the clauses vertically and use a leading, not trailing, comma.
select a
, b
, count(*) as count
from table
where cond1
and cond2
group by a, b
order by count descThis is a nice idea, but my problem with most of these tools is that they work with pure SQL/JS/whatever files, which isn't always the case. For example, if you use something like myBatis, you'll probably build the SQL dynamically, which could be stored in a mapper XML file: https://mybatis.org/mybatis-3/dynamic-sql.html Not only that, but certain frameworks have you embedding SQL inside of the main application code,…
This is a nice idea, but my problem with most of these tools is that they work with pure SQL/JS/whatever files, which isn't always the case. For example, if you use something like myBatis, you'll probably build the SQL dynamically, which could be stored in a mapper XML file: https://mybatis.org/mybatis-3/dynamic-sql.html Not only that, but certain frameworks have you embedding SQL inside of the main application code,…
There surely is a need for a sql linter, but if it wants to be strict about syntax style, it should better familiarize itself with not-noob styles first. Eg. some people like to align the clauses vertically and use a leading, not trailing, comma. select a , b , count(*) as count from table where cond1 and cond2 group by a, b order by count desc
I wondered how much good you could do with an SQL linter that didn't have any access to the underlying schema, and the answer seems to be "mostly whitespace and capitalization issues".
There surely is a need for a sql linter, but if it wants to be strict about syntax style, it should better familiarize itself with not-noob styles first. Eg. some people like to align the clauses vertically and use a leading, not trailing, comma. select a , b , count(*) as count from table where cond1 and cond2 group by a, b order by count desc
Leading comma is configurable, but I wouldn't know if the linter allows for that layout. Can't say I've seen it before, is it specific to a particular development environment?
I’ve done it this way before because it was quicker to edit, and and remove lines. But it’s not a format I’d particularly like to share with others because it looks weird.
This is a linter which complains about spaces and newlines, but lets "WHERE col = NULL" pass (which can never be meaningful) just fine? Obviously this depends on the rules configuration, but just judging that first smell test, it seems very ill thought out.
I guess it depends on what you want out of a linter e.g. if you want it to check just syntax or semantics as well. Is “= NULL” syntactically correct?