schemachange icon indicating copy to clipboard operation
schemachange copied to clipboard

Escaping Semi-Colons in task creation

Open short-hi opened this issue 2 years ago • 1 comments

Hello, hopefully I haven't missed anything in the documentation, but I have a question:

Currently we have an issue with Snowflake Task creation when using SchemaChange. The script looks something like this:

create or replace task TSK_REFRESH_PIPES
    warehouse=DEV_XS
    schedule='120 MINUTE'
    COMMENT='Temporary task to schedule daily refresh. Needs to be replace by a AWS SQS/SNS'
    as BEGIN
                ALTER PIPE  PIPE_CUSTOMERS refresh;
                ALTER PIPE  PIPE_CUSTOMERS_ANSWERS refresh;
                ALTER PIPE  PIPE_CUSTOMERS_DATA refresh;
        END
;

The reason this will not run correctly through SchemaChange is because of the semi-colons after the "Alter pipe" statements. However, when removing them Snowflake won't accept the query as valid. Manually running the above statement through snowflake poses no issue.

Is there a way to escape semi-colons in SchemaChange?

short-hi avatar Aug 08 '22 10:08 short-hi

We have the same issue with deploying procedures. The root cause is that the tool splits the sql on the ';' as it believes they are separate statements, which is incorrect in this case.

https://github.com/snowflakedb/snowflake-connector-python/blob/main/src/snowflake/connector/connection.py#L669

chriskallen avatar Sep 06 '22 22:09 chriskallen

Hmm, that's a good question. I'll have to do some research and see what the options are.

sfc-gh-jhansen avatar Oct 24 '22 22:10 sfc-gh-jhansen