-
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
SNOW-974746: Cannot use bind parameters with batch/multi statements #817
Comments
hi and thank you for submitting this issue! We observed the exactly same behaviour in other Snowflake drivers as well, which are absolutely independent from each other and even use different programming languages. See snowflakedb/snowflake-connector-nodejs#704 for reference So current suspicion is that this is something more 'central' and related to the Snowflake engine itself, instead of the drivers. The document you found is probably the most relevant in this case, it is indeed a bit confusing it only seems to address SQL API , yet the behaviour seems to be relevant for everything else, not just the SQL REST API. We're currently confirming this with the relevant dev team and will work on updating the drivers' individual documentation page, once confirmed. Since for this driver the README is the documentation ,I'm going to update it now. Until then, please assume that it won't work and the bit documented for SQL API is relevant for all the drivers, which is likely the case. As a side note, and this is probably an unexpected behaviour: with some other drivers (node.js, Python) the tests show that the qmark-style notation The real workaround should be to not depending on multi-statement queries and issue them one by one, where you need to use the |
created #819 for the documentation bit. Closing this issue as the current behaviour is very likely expected. |
Hi @sfc-gh-dszmolka and thanks for your comprehensive answer. I didn't even tried the qmark-style notation My feature is finished now but in the end I've done as you suggested: I abandonned multi-statement/batch queries and sent statements one by one with the named bind parameters Thanks for updating the documentation |
hi @paulverbeke thank you for the feedback and the additional informations; glad you're unblocked now! |
…in multi-statement queries (#819) re: SNOW-974746 / #817 document that we currently do not support bind variables in multi-statement queries, we're getting issues related to this document-only change, based on https://docs.snowflake.com/en/developer-guide/sql-api/submitting-multiple-statements#specifying-multiple-sql-statements-in-the-request which sems to be valid for all the drivers
Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!
What version of .NET driver are you using?
2.1.2.0
What operating system and processor architecture are you using?
W10 64bits
What version of .NET framework are you using?
.net framework 4.8
What did you do?
I constructed a query of 2 statements INSERT INTO.
INSERT INTO MY_TABLE VALUES (:1,:2,:3,:4,:5);INSERT INTO MY_TABLE VALUES (:6,:7,:8,:9,:10);
They both have bind parameters that are (all 10 of them, I checked) correctly added to the ParametersCollection.
Then I added the last parameter "MULTI_STATEMENT_COUNT" with a value of 0 for enabling batch statements.
What did you expect to see?
10 new rows should be inserted correctly but instead at execution I got an error:
I can send batch statements INSERT INTO without any problems - OK
I can send one INSERT INTO statement with bind parameters without any problems - OK
But as soon as there is severals statements in a batch AND bind parameters I receive an error - KO
I finally found this in the documentation of Snowflake, small note. "Snowflake does not currently support variable binding in multi-statement SQL requests."
https://docs.snowflake.com/en/developer-guide/sql-api/submitting-multiple-statements
Is this true ? Then why is it not documented in the readme of this connector ?
The text was updated successfully, but these errors were encountered: