-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to execute multiple statements in in a single API call? #33
Comments
It is not supported by Snowflake right now (a.k.a backend did not support it either) and no other driver support multiple statements. However, this is in our roadmap. |
@howryu any update on this? |
@howryu Our company is also interested in this being updated. |
+1 from me. |
Update: server side support of multi statement is in progress and JDBC will be the first driver supporting it. Then will come to .NET driver. @hkapre is our PM and he will have a better timeline or ETA |
For new feature requests, please reach out the support. We can discuss here but cannot commit it. Thank you. |
@howryu Our company is interested in this as well. |
If you're interested in making multiple insert statements, this may help |
@howryu Is there any update on this. We need to run queries with variables using the .NET driver. |
We are also interested in multiple SQL statements via python api. |
+1 here too, especially in the native stored procedure api, I could really use it now. For python the concurrent futures package is helpful, I used it once |
+1 here as well - I'm trying to write a Django backend for snowflake and multiple queries would be a really nice feature since snowflake has decided to omit the RETURNING (ansi standard command) from the dialect. I have to make three separate calls to get the last inserted id when one would due (I'm using the python API). |
any progress update after 3 years? 😔 |
@howryu is there any update on ODBC driver multiple query support. I am trying to run multiple queries in excel using ODBC snowflake driver connection. |
Any updates on this, for .net core 3.* code works on local debugging & updates it. But on after deploying to AWS lamda it gives error :
|
Have you guys tried https://docs.snowflake.com/en/user-guide/python-connector-api.html#execute_string ? |
@amine-mouffok Yes, in our project we actively use |
Hi, /Tiago Silva |
+1 |
I've found a workaround which is works for me. You just need to wrap multiple statements with the
With these operators I was able to use two |
You got my hopes up for a minute there. That may work with statements, but not with variables, which is what I need. Any reason why this still hasn't been implemented almost four years later? |
Can you please provide an example @WRJE ? |
Any use of a var in a query, which I can do in the Snowflake console but cannot do via the .NET driver. This example is from Snowflake's documentation: set (min, max)=(40, 70); It runs fine in the console, but via the .NET driver it produces the "Multiple SQL Statements not supported" error. If I use BEGIN/END, it says "$MIN does not exist". |
That's because you are using session variables. It would work with "regular" variables: Or if you set the session variable before the scripting block: |
OK, using the link you provided I was able to work up a sample of querying a value to use as a variable (which is what I needed this for): BEGIN So it looks like switching to "regular" variables (not sure the difference there either) allows me to at least setup a simple var and RETURN it. The problem is that I need these vars to be used in other SELECT statements. For example: BEGIN This runs without error in the .NET driver, but returns an empty anonymous block. No data. Even something as simple as 'SELECT :cust;" does the same. Can you use these vars in queries, or is that only for session variables? |
Yes, you can. begin SELECT * FROM MY_TABLE; |
That isn't working for me. As-is, it produces the "multiple API calls" error because it sees the begin/end and SELECT as separate calls. If I put the SELECT inside the begin/end, it produces the same empty anonymous block, presumably because the SELECT in the CREATE statement is generating the same output as a stand-alone SELECT statement (which is an empty block). |
our company is also having issues and interested in any computation-wise solutions for this! hope to see some progress |
Hard to believe that this functionality doesn't exist at this point. A very basic capability. |
I'm unable to get the BEGIN/END workaround to work with parameters. The following results in a "SQL compilation error: error line 4 at position 42 invalid identifier 'GROUPCODE'":
Removing the BEGIN/END results in the original "Multiple SQL statements in a single API call are not supported; use one API call per statement instead." error:
This line on it's own works fine:
Any ideas or suggestions? |
Multi Statement support for .NET has been addressed in the .NET release in November 2022 - For more details please refer to .NET release notes - https://community.snowflake.com/s/article/Dot-NET-Driver-Release-Notes |
Add parameter "MULTI_STATEMENT_COUNT" to 3, which means the query contains 3 statements. set to 0 is no limit (but not recommended, because sql injection). |
does this work for python as well? seeing same frustrating issue with multi-statement queries and using set varaibles |
were you able to figure this out..the SELECT part? |
multi statement (batch) support has been added but only without bind parameters ? |
My SQL has multiple SQL statements. While using execute reader method I am getting error {"Multiple SQL statements in a single API call are not supported; use one API call per statement instead."}
The text was updated successfully, but these errors were encountered: