[英]How to set dynamic schema name in JDBC Kafka source connector
I am using SAP HANA source connector "connector.class":"com.sap.kafka.connect.source.hana.HANASourceConnector"
to import data into kafka topics.我正在使用 SAP HANA 源连接器
"connector.class":"com.sap.kafka.connect.source.hana.HANASourceConnector"
将数据导入 kafka 主题。
I want to have costume name/namespace for avro schemas that being created by the connector.我想为连接器创建的 avro 模式提供服装名称/命名空间。 Therefore, I've used the
SetSchemaMetadata
function to transform the schema name.因此,我使用了
SetSchemaMetadata
function 来转换模式名称。
here is an example of my connector configuration:这是我的连接器配置的示例:
"key.converter.schemas.enable": true,
"key.converter": "io.confluent.connect.avro.AvroConverter",
"key.converter.schema.registry.url": "http://xx.xx.xx/schema/",
"key.converter.enhanced.avro.schema.support": true,
"value.converter": "io.confluent.connect.avro.AvroConverter",
"value.converter.schema.registry.url": "http://xx.xx.xx/schema/",
"value.converter.enhanced.avro.schema.support": true,
"transforms":"SetSchemaMetadata",
"transforms.SetSchemaMetadata.type":"org.apache.kafka.connect.transforms.SetSchemaMetadata$Value",
"transforms.SetSchemaMetadata.schema.name":"com.company.kafka.avro.table",
"table1.table.name": "\"database\".\"schema.table1\"",
"table2.table.name": "\"database\".\"schema.table2\"",
This will result that both schemas (table1-value & table2-value) will have the namespace "com.company.kafka.avro" and name "table"这将导致两个模式(table1-value 和 table2-value)都将具有命名空间“com.company.kafka.avro”和名称“table”
is there anyway to make the schema name the same as topic name?无论如何使架构名称与主题名称相同? something like:
"transforms.SetSchemaMetadata.schema.name":"com.company.kafka.avro.${topic}",
类似:
"transforms.SetSchemaMetadata.schema.name":"com.company.kafka.avro.${topic}",
or is there anyway to specifiy it manually for each topic and schema?或者无论如何要为每个主题和模式手动指定它?
There is no direct way that I know to do this.我知道没有直接的方法可以做到这一点。 Instead create a separate connector for each of the tables.
而是为每个表创建一个单独的连接器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.