snowflake-kafka-connector icon indicating copy to clipboard operation
snowflake-kafka-connector copied to clipboard

Column name as sql keyword

Open jandanecki opened this issue 1 year ago • 6 comments

Hello, My kafka message contains field trigger. When I run connector to read those messages I got error

2023-08-01 07:25:50,132 WARN [snowflake-connector|task-1] Failure altering table to add column: <topic_name>, this could happen when multiple partitions try to alter the table at the same time and the warning could be ignored (com.snowflake.kafka.connector.internal.streaming.SchematizationUtils) [task-thread-snowflake-connector-1]
snowflake-connect-connect-5b4c4778c9-rc9h7 snowflake-connect-connect com.snowflake.kafka.connector.internal.SnowflakeKafkaConnectorException: [SF_KAFKA_CONNECTOR] Exception: Failed to append columns
snowflake-connect-connect-5b4c4778c9-rc9h7 snowflake-connect-connect Error Code: 2015
snowflake-connect-connect-5b4c4778c9-rc9h7 snowflake-connect-connect Detail: Failed to append columns during schema evolution
snowflake-connect-connect-5b4c4778c9-rc9h7 snowflake-connect-connect Message: SQL compilation error:
snowflake-connect-connect-5b4c4778c9-rc9h7 snowflake-connect-connect syntax error line 1 at position 621 unexpected 'trigger'.
snowflake-connect-connect-5b4c4778c9-rc9h7 snowflake-connect-connect net.snowflake.client.jdbc.SnowflakeUtil.checkErrorAndThrowExceptionSub(SnowflakeUtil.java:129)
snowflake-connect-connect-5b4c4778c9-rc9h7 snowflake-connect-connect net.snowflake.client.jdbc.SnowflakeUtil.checkErrorAndThrowException(SnowflakeUtil.java:70)
snowflake-connect-connect-5b4c4778c9-rc9h7 snowflake-connect-connect net.snowflake.client.core.StmtUtil.pollForOutput(StmtUtil.java:456)

Is there any solution to this?

jandanecki avatar Aug 01 '23 08:08 jandanecki

We have a backlog item on this and will add support in the coming releases. Do note that schema detection and evolution support for kafka connector is in a public preview state.

The right way to handle this right is to double quote the column name when schema evolution tries to add the column.

https://docs.snowflake.com/en/sql-reference/reserved-keywords

sfc-gh-xhuang avatar Aug 01 '23 17:08 sfc-gh-xhuang

Thanks for reply! Do you have any estimation when it will be live?

jandanecki avatar Aug 02 '23 07:08 jandanecki

Not really, we will keep you updated. As a workaround, you can create a table with the trigger column first.

sfc-gh-tzhang avatar Aug 03 '23 21:08 sfc-gh-tzhang

This should be fixed with this PR: https://github.com/snowflakedb/snowflake-kafka-connector/pull/693

We will release 2.0.2 in the next few weeks

sfc-gh-xhuang avatar Sep 06 '23 17:09 sfc-gh-xhuang

Thanks for update! Next few weeks is more like 1-2 weeks or 5-6? I'm asking because it's blocking us a bit

jandanecki avatar Sep 12 '23 07:09 jandanecki

We are planning to stick to once a month release cadence for client side releases. so end of this month is the right expectation IMO.

sfc-gh-japatel avatar Sep 12 '23 21:09 sfc-gh-japatel