1
votes

I am trying to get the auto-incremented key of the table in which I am inserting. However, Snowflake simply throws this exception org.skife.jdbi.v2.exceptions.UnableToCreateStatementException: java.sql.SQLFeatureNotSupportedException

Does anyone know if the latest versions of Snowflake DB support this or not?

2
You should ask the developers of the Snowflake JDBC driver if they support it.Mark Rotteveel
I’m voting to close this question because you should ask the developers of the Snowflake JDBC driver if they support it.user207421

2 Answers

0
votes

Yes, I would recommend using this as a reference for COPY INTO a table from an S3 bucket reference: https://community.snowflake.com/s/article/how-to-copy-into-a-table-with-an-auto-increment-column

It looks like that it is optimal to have a staged version first with the table defined the column with auto-increment.

Can you please share how you are inserting and creating the table data that throws you this error?

0
votes

Snowflake JDBC driver documentation doesn't mention getGeneratedKeys() method.

At least Snowflake JDBC Driver 3.12.10 doesn't support support Statement#getGeneratedKeys()

SnowflakeStatementV1.java has this implementation which returns an empty ResultSet which is a bad implementation. According to JDBC API it should throw SQLFeatureNotSupportedException since the feature clearly is not supported.

  @Override
  public ResultSet getGeneratedKeys() throws SQLException {
    logger.debug("getGeneratedKeys()");
    raiseSQLExceptionIfStatementIsClosed();
    return new SnowflakeResultSetV1.EmptyResultSet();
  }