schemachange
schemachange copied to clipboard
Escaping Semi-Colons in task creation
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?
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
Hmm, that's a good question. I'll have to do some research and see what the options are.