This piece of code:
SELECT acfc.adcategoryid, acfc.targetmetadatadefinitionid
FROM [adcategoryfiltercondition] acfc
GROUP BY acfc.adcategoryid, acfc.targetmetadatadefinitionid
HAVING acfc.targetmetadatadefinitionid IS NOT NULL
should be fine according to the style guide that is linked in the docs: https://www.sqlstyle.guide/
But running flake8-sql gives two errors: Q447 and Q449:
Q447 root_keywords SELECT and GROUP BY are not right aligned
Q449 token HAVING should be aligned to the right of the river
Speaking of GROUP BY, an example in the style guide is here: https://www.sqlstyle.guide/#spaces, i.e. only GROUP is aligned to the right of the river, but flake8-sql requires the whole GROUP BY to be aligned to the right of the river, i.e. this doesn't give an error:
SELECT acfc.adcategoryid, acfc.targetmetadatadefinitionid
FROM [adcategoryfiltercondition] acfc
GROUP BY acfc.adcategoryid, acfc.targetmetadatadefinitionid
In terms of HAVING, there's no example in the style guide, but I believe it should be just like WHERE, that is it should be a root_keyword and required to be aligned to the right of the river. Such an approach is mentioned for example in here.
This piece of code:
should be fine according to the style guide that is linked in the docs: https://www.sqlstyle.guide/
But running flake8-sql gives two errors: Q447 and Q449:
Speaking of
GROUP BY, an example in the style guide is here: https://www.sqlstyle.guide/#spaces, i.e. onlyGROUPis aligned to the right of the river, but flake8-sql requires the wholeGROUP BYto be aligned to the right of the river, i.e. this doesn't give an error:In terms of
HAVING, there's no example in the style guide, but I believe it should be just likeWHERE, that is it should be a root_keyword and required to be aligned to the right of the river. Such an approach is mentioned for example in here.