-
-
Notifications
You must be signed in to change notification settings - Fork 661
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Snowflake: Added
AlterTableStatement
specific for Snowflake (#2267)
- Loading branch information
1 parent
6815d91
commit 0ea874b
Showing
6 changed files
with
317 additions
and
136 deletions.
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,9 @@ | ||
ALTER TABLE my_old_table RENAME TO my_new_table; | ||
|
||
ALTER TABLE my_existing_table SWAP WITH my_another_table; | ||
|
||
ALTER TABLE my_table SET DATA_RETENTION_TIME_IN_DAYS = 30; | ||
|
||
ALTER TABLE my_table SET DEFAULT_DDL_COLLATION = 'en-ci'; | ||
|
||
ALTER TABLE my_table SET COMMENT = 'my table comment'; |
65 changes: 65 additions & 0 deletions
65
test/fixtures/dialects/snowflake/snowflake_alter_table.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,65 @@ | ||
# 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: bc4f7d830f87054dbf6d7b40125a08cda4fbfe4ee52186811a821493f955ad45 | ||
file: | ||
- statement: | ||
alter_table_statement: | ||
- keyword: ALTER | ||
- keyword: TABLE | ||
- table_reference: | ||
identifier: my_old_table | ||
- keyword: RENAME | ||
- keyword: TO | ||
- table_reference: | ||
identifier: my_new_table | ||
- statement_terminator: ; | ||
- statement: | ||
alter_table_statement: | ||
- keyword: ALTER | ||
- keyword: TABLE | ||
- table_reference: | ||
identifier: my_existing_table | ||
- keyword: SWAP | ||
- keyword: WITH | ||
- table_reference: | ||
identifier: my_another_table | ||
- statement_terminator: ; | ||
- statement: | ||
alter_table_statement: | ||
- keyword: ALTER | ||
- keyword: TABLE | ||
- table_reference: | ||
identifier: my_table | ||
- keyword: SET | ||
- parameter: DATA_RETENTION_TIME_IN_DAYS | ||
- comparison_operator: | ||
raw_comparison_operator: '=' | ||
- literal: '30' | ||
- statement_terminator: ; | ||
- statement: | ||
alter_table_statement: | ||
- keyword: ALTER | ||
- keyword: TABLE | ||
- table_reference: | ||
identifier: my_table | ||
- keyword: SET | ||
- parameter: DEFAULT_DDL_COLLATION | ||
- comparison_operator: | ||
raw_comparison_operator: '=' | ||
- literal: "'en-ci'" | ||
- statement_terminator: ; | ||
- statement: | ||
alter_table_statement: | ||
- keyword: ALTER | ||
- keyword: TABLE | ||
- table_reference: | ||
identifier: my_table | ||
- keyword: SET | ||
- parameter: COMMENT | ||
- comparison_operator: | ||
raw_comparison_operator: '=' | ||
- literal: "'my table comment'" | ||
- statement_terminator: ; |
23 changes: 13 additions & 10 deletions
23
test/fixtures/dialects/snowflake/snowflake_alter_table_column.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 |
---|---|---|
@@ -1,32 +1,35 @@ | ||
-- SET/DROP column properties | ||
-- Single column | ||
alter table t1 alter column c1 drop not null; | ||
alter table t1 alter c5 comment '50 character column'; | ||
|
||
-- Multiple columns/properties | ||
alter table t1 modify c2 drop default, c3 set default seq5.nextval ; | ||
|
||
alter table t1 alter c4 set data type varchar(50), column c4 drop default; | ||
|
||
alter table t1 alter c5 comment '50 character column'; | ||
|
||
-- SET Masking Policy | ||
-- Single column | ||
ALTER TABLE xxxx.example_table MODIFY COLUMN employeeCode SET MASKING POLICY example_MASKING_POLICY; | ||
|
||
alter table empl_info modify column empl_id set masking policy mask_empl_id; | ||
|
||
-- multiple columns | ||
|
||
-- Multiple columns | ||
alter table empl_info modify | ||
column empl_id set masking policy mask_empl_id | ||
, column empl_dob set masking policy mask_empl_dob | ||
; | ||
|
||
-- single column | ||
|
||
-- UNSET masking policy | ||
-- Single column | ||
alter table empl_info modify column empl_id unset masking policy; | ||
|
||
-- multiple columns | ||
|
||
-- Multiple columns | ||
alter table empl_info modify | ||
column empl_id unset masking policy | ||
, column empl_dob unset masking policy | ||
; | ||
|
||
alter table test_table column test_column; | ||
alter table test_schema.test_table column test_column; | ||
-- DROP COLUMN | ||
ALTER TABLE empl_info DROP COLUMN my_column; | ||
ALTER TABLE some_schema.empl_info DROP COLUMN my_column; |
Oops, something went wrong.