-
Notifications
You must be signed in to change notification settings - Fork 133
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-974954: Binding variables are dropped when executing multiple statements #704
Comments
hi and thank you for submitting this issue - we're going to take a look at it |
seems to work correctly with sqlText: 'INSERT INTO test_db.node704.table_1(id)\n' +
' VALUES (1);\n' +
' INSERT INTO test_db.node704.table_2t(id)\n' +
" SELECT ?;\n",
binds: [2],
parameters: { MULTI_STATEMENT_COUNT: 2 }, using |
using latest Snowflake Python Connector 3.5.0 on Python 3.10, with below repro script: import snowflake.connector
# https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-example#qmark-or-numeric-binding
snowflake.connector.paramstyle='numeric'
con = snowflake.connector.connect(
user='user',
password='password',
account='myaccount.eu-central-1',
warehouse='COMPUTE_WH'
)
query = "INSERT INTO test_db.node704.table_1(id) VALUES(1); INSERT INTO test_db.node704.table_2t(id) SELECT :1"
res = con.cursor().execute(query, [2], num_statements=2)
# con.cursor().execute(<multiple statements>).fetchall() doesnt work, known issue
# https://github.com/snowflakedb/snowflake-connector-python/issues/1604
while res.nextset():
print(res.fetchone()) produces
changing repro script to ...
snowflake.connector.paramstyle='qmark'
...
query = "INSERT INTO test_db.node704.table_1(id) VALUES(1); INSERT INTO test_db.node704.table_2t(id) SELECT ?" (again, nothing else just
and data is correctly inserted into the target table. Behaves exactly like the Node.JS driver. While this behaviour might be unexpected, it looks like more like related to the Snowflake engine internals, rather than the Snowflake Node.JS driver here since with a totally different programming language, different Snowflake driver, the result is exactly the same. edit: since this behaviour is not related to Snowflake Node.JS driver, closing this one. If you think the behaviour is still specific to this library, please update this ticket with the details and I'll reopen to investigate further. |
Thanks for investigating this @sfc-gh-dszmolka . Using |
i'll take this further with the folks responsible for the engine, because since my last comment it also came to my attention that the exact same issue persist with a third (.NET) Snowflake driver - which further confirms it's not driver related, and also that we'd need to address this in a more central location. If you are a Snowflake customer (or even a trial user) you can file an official support ticket with Snowflake Support if you wish, but I'll take this up anyways with the engine dev team. |
found this SQL API doc https://docs.snowflake.com/en/developer-guide/sql-api/submitting-requests#using-bind-variables-in-a-statement
which seems to be what happens here (and maybe it's the |
I am seeing behaviour with the driver wherein binding variables appear to be dropped when executing multiple statements. See an example snippet below. I receive errors of the form
What version of NodeJS driver are you using?
1.9.1
What operating system and processor architecture are you using?
Mac OS 13.4
What version of NodeJS are you using?
v18.18.0
5.Server version:* E.g. 1.90.1
You may get the server version by running a query:
Here is an example snippet
Query should execute without error
The text was updated successfully, but these errors were encountered: