Open Francois-lenne opened 3 months ago
@Francois-lenne: https://github.com/Snowflake-Labs/schemachange/issues/171#issuecomment-1641109128
I ran into the same issue the other day.
Putting the multi-line sql into a proc and then calling it in the task was the workaround that we had to do. In your case, could wrap all those calls into a single proc (that calls the host of them) and then call that wrapper proc in the task.
@AMcNeice
Hello Andy yes i also think about this solutions i try the synthax for snowsql also but still the same error. The others solutions is probably to use the git integrations to snowflake and do an execute immediate command in a task
Just want to mention we are also seeing this issue. Hope a fix comes soon.
I haven't tested this with schemachange
yet but the following example from the bottom of the Snowflake EXECUTE IMMEDIATE documentation page helped resolve a similar issue I had running SQL scripts with the snow cli. I believe any snowflake tool using the python connector on the backend and executing a query via execute_stream
or execute_string
will run into this problem.
EXECUTE IMMEDIATE $$
DECLARE
rs RESULTSET;
query VARCHAR DEFAULT 'SELECT * FROM invoices WHERE price > ? AND price < ?';
minimum_price NUMBER(12,2) DEFAULT 20.00;
maximum_price NUMBER(12,2) DEFAULT 30.00;
BEGIN
rs := (EXECUTE IMMEDIATE :query USING (minimum_price, maximum_price));
RETURN TABLE(rs);
END;
$$
;
TLDR; wrap your code block with...
EXECUTE IMMEDIATE $$
....
$$
;
Description
When i try to run a a task with multiple line i have this issue :
snowflake.connector.errors.ProgrammingError: 001003 (42000): SQL compilation error: syntax error line 9 at position 63 unexpected '<EOF>'.
To Reproduce Steps to reproduce the behavior:
This is my code (my variable ENV work i'm 100% sure)
Expected behavior
In snowsight the code is running and create the task
Schemachange (please complete the following information):
schemachange version: 3.7.0