Skip to content

Commit

Permalink
Support QUALIFY clause in Snowflake
Browse files Browse the repository at this point in the history
Fixes #539
  • Loading branch information
nene committed Dec 15, 2022
1 parent c7b6d26 commit 7f46aa5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/languages/snowflake/snowflake.formatter.ts
Expand Up @@ -14,6 +14,7 @@ const reservedClauses = expandPhrases([
'HAVING',
'PARTITION BY',
'ORDER BY',
'QUALIFY',
'LIMIT',
'OFFSET',
'FETCH [FIRST | NEXT]',
Expand Down
11 changes: 11 additions & 0 deletions test/snowflake.test.ts
Expand Up @@ -90,6 +90,17 @@ describe('SnowflakeFormatter', () => {
`);
});

it('supports QUALIFY clause', () => {
expect(format(`SELECT * FROM tbl QUALIFY ROW_NUMBER() OVER my_window = 1`)).toBe(dedent`
SELECT
*
FROM
tbl
QUALIFY
ROW_NUMBER() OVER my_window = 1
`);
});

it('formats ALTER TABLE ... ALTER COLUMN', () => {
expect(
format(
Expand Down

0 comments on commit 7f46aa5

Please sign in to comment.