-
Notifications
You must be signed in to change notification settings - Fork 167
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-906944: Implement PreparedStatement.setArray #1506
Comments
@sfc-gh-anugupta FYI |
hi and apologies it took so long - it looks like the functionality was implemented as part of structured types support , which change was just released yesterday with v3.16.0 |
Hey @sfc-gh-dszmolka, thank you for implementing! Unfortunately, I haven't been able to work out the intended way to use this. I created an |
hi @nikammerlaan double checked with the team implementing the feature and per their feedback, should work if the Structured Types (public preview) feature is enabled on the server-side. Considering its documentation, it says it should be already available for all accounts. An example which has been tested and worked: SnowflakePreparedStatementV1 stmt =
(SnowflakePreparedStatementV1)
connection.prepareStatement(
"INSERT INTO array_of_integers (arrayInt) SELECT ?;"); ) {
statement.execute(" CREATE OR REPLACE TABLE array_of_integers(arrayInt ARRAY(INTEGER))");
Array array = connection.createArrayOf("INTEGER", new Integer[] {1, 2, 3});
stmt.setArray(1, array);
stmt.executeUpdate(); can you please test it and see how it works for you? |
What is the current behavior?
Not implemented, not documented. Arrays must be converted to a String and then parsed back into an Array in Snowflake.
What is the desired behavior?
Have direct support for Arrays by implementing setArray
How would this improve
snowflake-jdbc
?Parity with java.sql.PreparedStatement. Tighter integration with snowflake types. Less String manipulation.
References, Other Background
A previous issue was created for this but never acknowledged: #382
The text was updated successfully, but these errors were encountered: