I have used KSQL to create a stream and an aggregated table off that stream.
{
"ksql":"DROP Stream IF EXISTS StreamLegacyNames; DROP Stream IF EXISTS StreamLegacy; CREATE Stream StreamLegacy (payload STRUCT<AgeYr varchar>)WITH (KAFKA_TOPIC='eip-legacy-13',VALUE_FORMAT='JSON' ); CREATE Stream StreamLegacyNames As Select payload->AgeYr Age from StreamLegacy; Create Table DimAge As SELECT Age FROM StreamLegacyNames Group By Age;",
"streamsProperties":{
"ksql.streams.auto.offset.reset":"earliest"
}
}
What is the easiest way to export this code to a sql table? We are using the jdbc connector for topic but I am unclear if that would work for an aggregated KSQL table (In this example DIMAGE).
Even if I set the topic to DIMAGE and the following in the jdbc connect configuration file.
value.converter.schemas.enable=false
The full configuration file is
connector.class=io.confluent.connect.jdbc.JdbcSinkConnector
connection.password=PASSWORD
auto.evolve=true
topics=DIMAGE
tasks.max=1
connection.user=USER
value.converter.schemas.enable=false
auto.create=true
connection.url=jdbc:sqlserver://SERVER
I receive the following error in the connector.
Caused by: org.apache.kafka.connect.errors.DataException: JsonConverter with schemas.enable requires "schema" and "payload" fields and may not contain additional fields. If you are trying to deserialize plain JSON data, set schemas.enable=false in your converter configuration.
A KSQL query through postman shows the format of the KTABLE as
{"row":{"columns":["83"]},"errorMessage":null,"finalMessage":null}
{"row":{"columns":["74"]},"errorMessage":null,"finalMessage":null}
{"row":{"columns":["36"]},"errorMessage":null,"finalMessage":null}