'Snowsql: Asynchronous execution of erroneous SQL Stmts, but no error as result
I'm currently using Powershell and snowsql to execute numerous SQL statements asynchronously and want snowsql to raise an error on exit, if one of those sql statements couldn't be executed succesfully.
echo "insert into doesntexist (select 1);> select 1;>" | snowsql -o sfqid_in_error=true -o log_level=DEBUG -o exit_on_error=true --config "path/to/config"
The response I get is:
* SnowSQL * v1.2.21
Type SQL statements or !help
Goodbye!
But the insert statement doesn't run successfully. I would assume snowsql to exit with an error (hence exit_on_error=true) but this isn't the case.
Is this on purpose or a bug or has someone a better idea to solve this?
KR
Solution 1:[1]
I'm currently using Powershell and snowsql to execute numerous SQL statements asynchronously
As you execute the SQLs asynchronously, the results are not checked by SnowSQL. This is why it doesn't return any error. If you want to monitor if the queries were successfully executed, you can:
- wait until all queries are completed, and check the results. This can be done by using the query_history functions but it will require some coding (maybe you can use Snowflake Scripting for this).
- execute the queries synchronously.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Gokhan Atil |