You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. We are using the DbUp.Snowflake extension and are encountering errors when our SnowFlake scripts contain embedded JavaScript. The issue seems to be related to cases where we have multiple lines where the JavaScript command lines end with a ';' char.
Here is an example that we have been using. It is an example script from the SnowFlake website: create or replace procedure sp_pi() returns float not null language javascript as $$ return 3.1415926; $$ ;
The SnowflakeConnectionManager.SplitScriptIntoCommands takes this script and creates an array as [0] "create or replace procedure sp_pi()\r\n returns float not null\r\n language javascript\r\n as\r\n $$\r\n return 3.1415926" [1] "$$"
As you can see, we are now missing the closing $$ chars due to the split on the ';' char at the end of the JavaScript line in the 1st command and the 2nd command is just the closing $$ chars. This is raising an error:
System.Data.Odbc.OdbcException (0x80131937): ERROR [42000] SQL compilation error: parse error line 6 at position 20 near ''. syntax error line 5 at position 5 unexpected '$'. at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod) at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader) at System.Data.Odbc.OdbcCommand.ExecuteNonQuery() at DbUp.Support.ScriptExecutor.ExecuteNonQuery(IDbCommand command) in C:\Dev\DbUpSnowFlakeTest\src\dbup-core\Support\ScriptExecutor.cs:line 173 at DbUp.Support.ScriptExecutor.<>c__DisplayClass18_2.b__1() in C:\Dev\DbUpSnowFlakeTest\src\dbup-core\Support\ScriptExecutor.cs:line 146 at DbUp.Snowflake.SnowflakeScriptExecutor.ExecuteCommandsWithinExceptionHandler(Int32 index, SqlScript script, Action executeCallback) in C:\Dev\DbUpSnowFlakeTest\src\dbup-snowflake\SnowflakeScriptExecutor.cs:line 27
However, when we flatten out the script to a single line, the extension works as expected without any errors. So it seems to do with the regex in SnowflakeConnectionManager.SplitScriptIntoCommands.
Are we missing something with our usage of the Snowflake extension?
Thx. -Bill
The text was updated successfully, but these errors were encountered:
Hello. We are using the DbUp.Snowflake extension and are encountering errors when our SnowFlake scripts contain embedded JavaScript. The issue seems to be related to cases where we have multiple lines where the JavaScript command lines end with a ';' char.
Here is an example that we have been using. It is an example script from the SnowFlake website: create or replace procedure sp_pi() returns float not null language javascript as $$ return 3.1415926; $$ ;
The SnowflakeConnectionManager.SplitScriptIntoCommands takes this script and creates an array as [0] "create or replace procedure sp_pi()\r\n returns float not null\r\n language javascript\r\n as\r\n$$\r\n return 3.1415926" [1] "$$ "
As you can see, we are now missing the closing $$ chars due to the split on the ';' char at the end of the JavaScript line in the 1st command and the 2nd command is just the closing $$ chars. This is raising an error:
System.Data.Odbc.OdbcException (0x80131937): ERROR [42000] SQL compilation error: parse error line 6 at position 20 near ''. syntax error line 5 at position 5 unexpected '$'. at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod) at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader) at System.Data.Odbc.OdbcCommand.ExecuteNonQuery() at DbUp.Support.ScriptExecutor.ExecuteNonQuery(IDbCommand command) in C:\Dev\DbUpSnowFlakeTest\src\dbup-core\Support\ScriptExecutor.cs:line 173 at DbUp.Support.ScriptExecutor.<>c__DisplayClass18_2.b__1() in C:\Dev\DbUpSnowFlakeTest\src\dbup-core\Support\ScriptExecutor.cs:line 146 at DbUp.Snowflake.SnowflakeScriptExecutor.ExecuteCommandsWithinExceptionHandler(Int32 index, SqlScript script, Action executeCallback) in C:\Dev\DbUpSnowFlakeTest\src\dbup-snowflake\SnowflakeScriptExecutor.cs:line 27
However, when we flatten out the script to a single line, the extension works as expected without any errors. So it seems to do with the regex in SnowflakeConnectionManager.SplitScriptIntoCommands.
Are we missing something with our usage of the Snowflake extension?
Thx. -Bill
The text was updated successfully, but these errors were encountered: