New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parsing error while using ALTER commands on Snowflake Objects #3479
Comments
At present only some of the Adding these is relatively easy (as detailed in the Contributing Dialect Changes wiki), but would need someone to go through them all to create the syntax. |
Hi, I'm attempting to have a go at this as my first contribution via adding I was wondering if I could get some help with how to implement all the different params that are available? I've started off with this syntax:
Then using it in this way within the
Just wondering if this makes sense and /or is the most efficient way of implementing it. Thanks! |
Hey @jared-rimmer , that seems liek a reasonable approach. The best bet is to open a PR, and one of the maintainers will add suggestions there |
I was about to open a similar issue, but the three ALTER statements look like they could be the same thing, and maybe the CREATEs are somehow related? This may help you test this issue's fixes, or let me know if any of them should be their own separate issue. 🙏
results in...
with an empty |
I'm also facing parse errors when creating a STORAGE INTEGRATION like this:
The parsing violation is:
I understand that this is not support and I might try to contribute, is that right? |
Hi, I am running into a similar issue whereby all ALTER WAREHOUSE queries are producing PRS errors. These are examples of queries I'm trying to run: ALTER WAREHOUSE WH_TEST SET AUTO_SUSPEND = 600;
ALTER WAREHOUSE WH_TEST SET AUTO_RESUME = FALSE;
ALTER WAREHOUSE WH_TEST SET MIN_CLUSTER_COUNT = 1;
ALTER WAREHOUSE WH_TEST SET MAX_CLUSTER_COUNT = 1;
ALTER WAREHOUSE WH_TEST SET SCALING_POLICY = 'ECONOMY'; Now I'm new here, so I want to know if someone is already working on this feature? |
This should be solved be #5236. sqlfluff previously expected the storage_provider to be unquoted e.g. S3 instead of 'S3'. |
Hello, these Alter warehouse queries have been fixed by #5264 |
Hello there, I tested (sqlfluff 2.3.2) all the queries that have been mentioned in this issue to be able to work more easily on this issue. -- warehouse
-- Here i think the issue are the commas
ALTER WAREHOUSE CI_TRANSFORMING
SET COMMENT = 'Warehouse for dbt development transformations in CI'
, AUTO_RESUME = TRUE
, AUTO_SUSPEND=30;
--Resource monitor
CREATE RESOURCE MONITOR DEV_TRANSFORMING
WITH
CREDIT_QUOTA = 3 -- 3 credits per day, half of what it used to be.
FREQUENCY = DAILY
START_TIMESTAMP = IMMEDIATELY
NOTIFY_USERS = (NEVD) -- email must be verified.
TRIGGERS
ON 85 PERCENT DO NOTIFY
ON 100 PERCENT DO SUSPEND_IMMEDIATE;
ALTER RESOURCE MONITOR DEV_TRANSFORMING
SET NOTIFY_USERS = (NEVD);
CREATE RESOURCE MONITOR CI_TRANSFORMING
WITH
CREDIT_QUOTA = 3 -- 3 credits per day, given the other half.
FREQUENCY = DAILY
START_TIMESTAMP = IMMEDIATELY
NOTIFY_USERS = (NEVD)
TRIGGERS
ON 85 PERCENT DO NOTIFY
ON 100 PERCENT DO SUSPEND_IMMEDIATE;
ALTER RESOURCE MONITOR CI_TRANSFORMING
SET NOTIFY_USERS = (NEVD);
ALTER RESOURCE MONITOR RM_TEST SET CREDIT_QUOTA=2000 TRIGGERS ON 80 PERCENT DO NOTIFY ON 100 PERCENT DO SUSPEND_IMMEDIATE;
-- Account
ALTER ACCOUNT SET TIMEZONE = 'UTC';
-- Database
ALTER DATABASE DB_TEST RENAME TO DB_TEST_NEW;
-- Network policy
ALTER NETWORK POLICY MYPOLICY1 SET ALLOWED_IP_LIST=('192.168.1.0/24', '192.168.255.100');
-- sequence
ALTER SEQUENCE SEQ_TEST SET INCREMENT = 2;
--procedure
ALTER PROCEDURE IF EXISTS PROCEDURE1(float) RENAME TO PROCEDURE2;
-- MASKING POLICY
ALTER MASKING POLICY EMAIL_MASK SET BODY ->
CASE
WHEN CURRENT_ROLE() IN ('ANALYST') THEN VAL
ELSE SHA2(VAL, 512)
END; I think we could open one PR per resource type, because it will be easier to develop and review. If anyone wants to contribute on one sub-part of this issue feel free to just comment that you are handling one resource type and let's do it :D
PS: If anyone is motivated enough to create distinct issues per resource type that would be better but I think we can work with this issue like I said above. Btw it is easier to have issues related to one problem (so one resource type for example) PS2: If anyone wants to contribute but is unsure, feel free to seek for help :) |
I'll fix the |
I think this issue is now complete. All of it parses on main. Thanks everyone for contributing to this anthology issue! |
Search before asking
What Happened
Getting parsing error while trying to parse SQL statements which uses ALTER commands.
Tried parsing below ALTER statements with SQLFLUFF and got parsing error. The statements are from Snowflake docs
Expected Behaviour
The Statements which are mentioned above are valid statements and executed fine in the Snowflake UI without any issues
Observed Behaviour
Could see the ALTER commands are failing for some of the Snowflake objects. For other objects like Schema, Table, View etc the ALTER commands were working fine
How to reproduce
sqlfluff lint Alter_test.sql --dialect snowflake
Dialect
Snowflake
Version
0.13.2
Configuration
[sqlfluff]
dialect = snowflake
[sqlfluff:rules:L014]
extended_capitalisation_policy = consistent
Are you willing to work on and submit a PR to address the issue?
Code of Conduct
The text was updated successfully, but these errors were encountered: