Snowflake connection with parameterized queries failing
book
Article ID: KB0070428
calendar_today
Updated On:
Description
Snowflake connections with parameterized queries fail in Spotfire, while connections without these queries are successful. Error seen in debug log similar to:
===========
External error:
ERROR [HY000] [Snowflake][Snowflake] (4)
REST request for URL *** failed: HTTP error (http error) - code=400.
===========
Issue/Introduction
A Snowflake connection that uses parameterized queries fails, while simple data connections are successful
Resolution
As seen from the Snowflake ODBC Driver Release notes documented here, a behavior change was introduced in the ODBC Driver 3.1.0
To improve performance, the SQLExecDirect() function no longer unnecessarily validates parameter bindings for a query.
Previously (versions 3.0.2 and earlier), the driver sent two requests for each query execution request from a client application using the ODBC Driver through the function SQLExecDirect() call: a describe request and an execute request. To improve the performance the describe request is omitted in ODBC Driver 3.1.0 and above.
This means that the function call that is sent to Snowflake from Spotfire won't send a describe request to get the metadata of the query before the actual execution. As a result, the driver won't validate the parameter bindings.
Due to this change, with ODBC 3.1.0 and above, query requests with bindings from Spotfire were not validated.
As a workaround, Snowflake Engineering has recommended enabling this parameter EnableDescribeDirectExec=true in the ODBC DSN to force the validation of query bindings before a request for execution is sent. This change has been tested and approved by Snowflake Engineering.
Additional Information
https://community.snowflake.com/s/article/ODBC-Driver-Release-Notes
Feedback
thumb_up
Yes
thumb_down
No