JDBC Source Connector using a rowversion column for timestamp mode

Hi,

Some of my tables in SQL Server only includes a timestamp(rowversion) column to specify the changes.
I tried some type conversions like
"query":SELECT *, DATEADD(MILLISECOND,CAST(Timest AS bigint),CAST('1900-01-01 00:00:00.0000000' AS datetime2)) AS MyNewDatetime FROM ProductPrice

But id didn’t worked as expected:)

Is it possible to use this unique binary column on jdbc source connector with any mode or am i trying the impossible?

Thanks.

I solved it with a subselect query which basically adds a new datetime2 column to my query results. With this approach i can use any rawversion or unique binary columns for mode:timestamp.

Here is my full config :paperclip:

 "config": {
            "connector.class"                                                : "io.confluent.connect.jdbc.JdbcSourceConnector",
            "connection.url"                                                 : "jdbc:sqlserver://localhost:1433;databaseName=TestDB;",
            "connection.user"                                                : "User",
            "connection.password"                                            : "Password",
            "numeric.mapping"                                                : "best_fit",
            "tasks.max"                                                      : "1",
            "name"                                                           : "test1",
            "mode"                                                           : "timestamp",
            "query"                                                          : "SELECT * FROM (select *,DATEADD(MILLISECOND,CAST(Timest AS bigint),CAST('1900-01-01 00:00:00.0000000' AS datetime2)) AS MyNewTimeStamp FROM Price) X",
            "timestamp.column.name"                                          : "MyNewTimeStamp",
            "table.types"                                                    : "TABLE",
            "topic.prefix"                                                   : "jdbc_sqlserver_",
            "validate.non.null"                                              : "false",
            "topic.creation.enable"                                          : "true",
            "topic.creation.default.replication.factor"                      : "3",
            "topic.creation.default.partitions"                              : "3"
  }

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.