Muhamed Risvan M S
Muhamed Risvan M S

Reputation: 53

how to specify date type in the request body of SpoolDirCsvSourceConnector

I have the following request for reading csv

"connector.class":"com.github.jcustenborder.kafka.connect.spooldir.SpoolDirCsvSourceConnector","tasks.max": 1,"input.path": "C:/Risvan/kafka-connect/connect/local-kafka/unprocessed","input.file.pattern": "sample4.csv","error.path": "C:/Risvan/kafka-connect/connect/local-kafka/error","finished.path": "C:/Risvan/kafka-connect/connect/local-kafka/processed","topic":"topic21""csv.first.row.as.header":true,"schema.generation.enabled: true,"transforms":"castTypes","transforms.castTypes.type":"org.apache.kafka.connect.transforms.Cast$Value","transforms.castTypes.spec":"phone:int64"

how to specify a field is of type date here. If I use

"transforms.castTypes.spec":"phone:int64,date:date"

it shows

    Invalid value java.lang.IllegalArgumentException: No enum constant 
    org.apache.kafka.connect.data.Schema.Type.DATE for configuration Invalid type found 
    in casting spec: date

date is in this format "05-07-2023 15:30:00"

Is there any way to specify a field is of type date?

Upvotes: 0

Views: 87

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191738

Kafka Connect has no Date type.

Keep it as a string. Use TimestampConverter transform if you have to parse to some other format

Upvotes: 0

Related Questions