Search code examples
apache-kafkaconfluent-platformdebezium

Autocreation appropriate DATETIME type fields using JDBC Sink Connector on SQL Server


I use Debezium 1.2

I have MSSQL databases and want to publish data from one table to many other tables in other DBs (usual scenario for Debezium)

So i setup MSSQL Source Connector and JDBC Sink Connector. Everything is fine except one thing. DATETIME columns are created as INT64 in consumer`s Databases.

I fixed it with such code in JDBC sink config:

        "transforms.TimestampConverter.format": "yyyy-MM-dd HH:mm:ss.SSSSSS",
        "transforms.TimestampConverter.target.type": "Timestamp",
        "transforms.TimestampConverter.field ": "date3",

Actually it works, but I have to write ALL columns of source tables (should I?). An in case multiple topics it will be not possible.

So here is the question: How can I configure sink/source to allow crete DATETIME columns automatically without iterating all known columns?


Solution

  • You can set time.precision.mode=connect - see https://debezium.io/documentation/reference/1.2/connectors/sqlserver.html#sqlserver-temporal-values