kokokruunch
kokokruunch

Reputation: 11

Confluent Kafka Oracle CDC Connector not parsing DATE format correctly

I'm using the Confluent Oracle CDC Connector https://docs.confluent.io/cloud/current/connectors/cc-oracle-cdc-source/cc-oracle-cdc-source.html. When I insert a record with a date column, the corresponding JSON that the connector outputs is an integer.

SQL TABLE (NOTE the PRODUCT_OFFERDATE's type)

describe DB_USER.DF_PRODUCT;

Name                Null?    Type

----------------------------------------

PRODUCT_ID          NOT NULL VARCHAR2(50)  
PRODUCT_NAME        NOT NULL VARCHAR2(75)  
PRODUCT_DESCRIPTION NOT NULL VARCHAR2(150)
PRODUCT_PRICE       NOT NULL NUMBER(10,2)  
PRODUCT_OFFERDATE   NOT NULL DATE  
PRODUCT_BUNDLED              VARCHAR2(1)  
LAST_TIMESTAMP      NOT NULL TIMESTAMP(6)

Inserting a new record --

INSERT INTO DB_USER.DF_PRODUCT VALUES (15, 'Sample product', 'Sample description', 11.50, DATE '2008-11-11', 'N', current_timestamp);

Kafka record --

{
  "PRODUCT_ID": "15",
  "PRODUCT_NAME": "Sample product",
  "PRODUCT_DESCRIPTION": "Sample description",
  "PRODUCT_PRICE": 11.5,
  "PRODUCT_OFFERDATE": 14194,
  "PRODUCT_BUNDLED": "N",
  "LAST_TIMESTAMP": 1676286930721,
  "table": "ORCL.DB_USER.DF_PRODUCT_2",
  "scn": "1427886",
  "op_type": "I",
  "op_ts": "1676247330000",
  "current_ts": "1676247331513",
  "row_id": "AAAF6yAAAAAAAM7AAI",
  "username": "ADMIN"
}

I've tried using the oracle.date.mapping and set to date but it still outputs the same format. The workaround I have at the moment is to create an SMT. It won't be ideal since I'll have more columns that will have a DATE type.

Any help would be appreciated.

Upvotes: 0

Views: 442

Answers (1)

Rajesh Shanmugam
Rajesh Shanmugam

Reputation: 157

Did you tried the timestamp parameter onsted of date.

"oracle.date.mapping": "timestamp",

Upvotes: 0

Related Questions