Skip to content

Commit 7f46aa5

Browse files
committed
Support QUALIFY clause in Snowflake
Fixes #539
1 parent c7b6d26 commit 7f46aa5

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/languages/snowflake/snowflake.formatter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const reservedClauses = expandPhrases([
1414
'HAVING',
1515
'PARTITION BY',
1616
'ORDER BY',
17+
'QUALIFY',
1718
'LIMIT',
1819
'OFFSET',
1920
'FETCH [FIRST | NEXT]',

test/snowflake.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,17 @@ describe('SnowflakeFormatter', () => {
9090
`);
9191
});
9292

93+
it('supports QUALIFY clause', () => {
94+
expect(format(`SELECT * FROM tbl QUALIFY ROW_NUMBER() OVER my_window = 1`)).toBe(dedent`
95+
SELECT
96+
*
97+
FROM
98+
tbl
99+
QUALIFY
100+
ROW_NUMBER() OVER my_window = 1
101+
`);
102+
});
103+
93104
it('formats ALTER TABLE ... ALTER COLUMN', () => {
94105
expect(
95106
format(

0 commit comments

Comments
 (0)