forked from sqlfluff/sqlfluff
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Snowflake: Add implementation for CREATE TASK statement (sqlfluff#1597)
- Loading branch information
Joe Hutter
committed
Oct 12, 2021
1 parent
42961a6
commit 3cdf37a
Showing
7 changed files
with
245 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE TASK t1 | ||
SCHEDULE = 'USING CRON 0 9-17 * * SUN America/Los_Angeles' | ||
TIMESTAMP_INPUT_FORMAT = 'YYYY-MM-DD HH24' | ||
USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE = 'XSMALL' | ||
AS | ||
INSERT INTO mytable(ts) VALUES(1); |
41 changes: 41 additions & 0 deletions
41
test/fixtures/dialects/snowflake/snowflake_create_task.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# YML test files are auto-generated from SQL files and should not be edited by | ||
# hand. To help enforce this, the "hash" field in the file must match a hash | ||
# computed by SQLFluff when running the tests. Please run | ||
# `python test/generate_parse_fixture_yml.py` to generate them after adding or | ||
# altering SQL files. | ||
_hash: af2323a0483bae83a81490bc28c4d8acd8b0c793aaa661b9dc0ed6d2d85fa7de | ||
file: | ||
statement: | ||
create_task_statement: | ||
- keyword: CREATE | ||
- keyword: TASK | ||
- object_reference: | ||
identifier: t1 | ||
- keyword: SCHEDULE | ||
- comparison_operator: '=' | ||
- literal: "'USING CRON 0 9-17 * * SUN America/Los_Angeles'" | ||
- parameter: TIMESTAMP_INPUT_FORMAT | ||
- comparison_operator: '=' | ||
- literal: "'YYYY-MM-DD HH24'" | ||
- keyword: USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE | ||
- comparison_operator: '=' | ||
- literal: "'XSMALL'" | ||
- keyword: AS | ||
- statement: | ||
insert_statement: | ||
- keyword: INSERT | ||
- keyword: INTO | ||
- table_reference: | ||
identifier: mytable | ||
- bracketed: | ||
start_bracket: ( | ||
column_reference: | ||
identifier: ts | ||
end_bracket: ) | ||
- values_clause: | ||
keyword: VALUES | ||
bracketed: | ||
start_bracket: ( | ||
literal: '1' | ||
end_bracket: ) | ||
statement_terminator: ; |
12 changes: 12 additions & 0 deletions
12
test/fixtures/dialects/snowflake/snowflake_create_task_all.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CREATE OR REPLACE TASK IF NOT EXISTS t1 | ||
WAREHOUSE = mywh | ||
SCHEDULE = 'USING CRON 0 9-17 * * SUN America/Los_Angeles' | ||
ALLOW_OVERLAPPING_EXECUTION = TRUE | ||
TIMESTAMP_INPUT_FORMAT = 'YYYY-MM-DD HH24' | ||
USER_TASK_TIMEOUT_MS = 25 | ||
USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE = 'XSMALL' | ||
COPY GRANTS | ||
COMMENT = 'Hello world' | ||
AFTER 'dependency_task' | ||
AS | ||
INSERT INTO mytable(ts) VALUES(1); |
64 changes: 64 additions & 0 deletions
64
test/fixtures/dialects/snowflake/snowflake_create_task_all.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# YML test files are auto-generated from SQL files and should not be edited by | ||
# hand. To help enforce this, the "hash" field in the file must match a hash | ||
# computed by SQLFluff when running the tests. Please run | ||
# `python test/generate_parse_fixture_yml.py` to generate them after adding or | ||
# altering SQL files. | ||
_hash: 3a40628753cbb7ee12f31d7f3738a8a18959c01821cb3db3c542cd17a2a04aa3 | ||
file: | ||
statement: | ||
create_task_statement: | ||
- keyword: CREATE | ||
- binary_operator: OR | ||
- keyword: REPLACE | ||
- keyword: TASK | ||
- keyword: IF | ||
- keyword: NOT | ||
- keyword: EXISTS | ||
- object_reference: | ||
identifier: t1 | ||
- keyword: WAREHOUSE | ||
- comparison_operator: '=' | ||
- object_reference: | ||
identifier: mywh | ||
- keyword: SCHEDULE | ||
- comparison_operator: '=' | ||
- literal: "'USING CRON 0 9-17 * * SUN America/Los_Angeles'" | ||
- keyword: ALLOW_OVERLAPPING_EXECUTION | ||
- comparison_operator: '=' | ||
- literal: 'TRUE' | ||
- parameter: TIMESTAMP_INPUT_FORMAT | ||
- comparison_operator: '=' | ||
- literal: "'YYYY-MM-DD HH24'" | ||
- keyword: USER_TASK_TIMEOUT_MS | ||
- comparison_operator: '=' | ||
- literal: '25' | ||
- keyword: USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE | ||
- comparison_operator: '=' | ||
- literal: "'XSMALL'" | ||
- keyword: COPY | ||
- keyword: GRANTS | ||
- snowflake_comment: | ||
keyword: COMMENT | ||
comparison_operator: '=' | ||
literal: "'Hello world'" | ||
- keyword: AFTER | ||
- literal: "'dependency_task'" | ||
- keyword: AS | ||
- statement: | ||
insert_statement: | ||
- keyword: INSERT | ||
- keyword: INTO | ||
- table_reference: | ||
identifier: mytable | ||
- bracketed: | ||
start_bracket: ( | ||
column_reference: | ||
identifier: ts | ||
end_bracket: ) | ||
- values_clause: | ||
keyword: VALUES | ||
bracketed: | ||
start_bracket: ( | ||
literal: '1' | ||
end_bracket: ) | ||
statement_terminator: ; |
3 changes: 3 additions & 0 deletions
3
test/fixtures/dialects/snowflake/snowflake_create_task_minimal.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CREATE TASK t1 | ||
AS | ||
INSERT INTO mytable(ts) VALUES(1); |
32 changes: 32 additions & 0 deletions
32
test/fixtures/dialects/snowflake/snowflake_create_task_minimal.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# YML test files are auto-generated from SQL files and should not be edited by | ||
# hand. To help enforce this, the "hash" field in the file must match a hash | ||
# computed by SQLFluff when running the tests. Please run | ||
# `python test/generate_parse_fixture_yml.py` to generate them after adding or | ||
# altering SQL files. | ||
_hash: 5e7d90046023eb14b11e0b6ee84b48e2160de04eae5298e041dbf4de00598a2c | ||
file: | ||
statement: | ||
create_task_statement: | ||
- keyword: CREATE | ||
- keyword: TASK | ||
- object_reference: | ||
identifier: t1 | ||
- keyword: AS | ||
- statement: | ||
insert_statement: | ||
- keyword: INSERT | ||
- keyword: INTO | ||
- table_reference: | ||
identifier: mytable | ||
- bracketed: | ||
start_bracket: ( | ||
column_reference: | ||
identifier: ts | ||
end_bracket: ) | ||
- values_clause: | ||
keyword: VALUES | ||
bracketed: | ||
start_bracket: ( | ||
literal: '1' | ||
end_bracket: ) | ||
statement_terminator: ; |