Open ibogretsov opened 3 years ago
+1
Thanks is for bumping this. We're happy to merge a fix for this. If you're interested in making this contribution please let me know as I'm happy to provide guidance.
+1. Can be solved using snowflake-connector-python v 2.9.0
Issue Summary
Hello, We are migrating from the Redshift to the Snowflake. We ran into one problem. Snowflake does not support the multiple statements in one API call.
Steps to Reproduce
For example in the worksheet we have queries:
Push
Execute
and receive next error message:000006 (0A000): Multiple SQL statements in a single API call are not supported; use one API call per statement instead.
This restriction makes it impossible to use temporary tables in the Redash for the Snowflake. This is a big problem for us, because our analytics use temporary tables to store intermediate data in these tables.I've investigated the Redash source code for the Snowflake query runner and the Snowflake documentation for snowflake.connector for python. I found that, yeah, cursor object's method
execute
, which is used in Redash, supports running only one query. But there is execute_string method of snowflake connection object which allows to run many SQL statements. It just splits sql query by delimiter, runs one by one and returns list of cursors.So, for the general Redash way to execute multiple sql statements (result only for the last query) need to get and parse data only from the last cursor.