[英]How to make the Kafka Connect BigQuery Sink Connector create one table per event type and not per topic?
I'm using confluentinc/kafka-connect-bigquery on our Kafka (Avro) events.我在我们的 Kafka (Avro) 事件中使用confluentinc/kafka-connect-bigquery 。 On some topics, we have more than one event type, eg, UserRegistered
and UserDeleted
are on the topic domain.user
.在某些主题上,我们有不止一种事件类型,例如, UserRegistered
和UserDeleted
在主题domain.user
上。
The subjects in our Schema Registry look as follows.我们的模式注册表中的主题如下所示。
curl --silent -X GET http://avro-schema-registry.core-kafka.svc.cluster.local:8081/subjects | jq .
[...]
"domain.user-com.acme.message_schema.domain.user.UserDeleted",
"domain.user-com.acme.message_schema.domain.user.UserRegistered",
"domain.user-com.acme.message_schema.type.domain.key.DefaultKey",
[...]
My properties/connector.properties
(I'm using the quickstart folder.) looks as follows:我的properties/connector.properties
(我使用的是quickstart文件夹。)如下所示:
[...]
topics.regex=domain.*
sanitizeTopics=true
autoCreateTables=true
[...]
In BigQuery a table called domain_user
is created.在 BigQuery 中,创建了一个名为domain_user
的表。 However, I would like to have two tables, eg, domain_user_userregistered
and domain_user_userdeleted
or similar, because the schemas of these two event types are quite different.但是,我希望有两个表,例如domain_user_userregistered
和domain_user_userdeleted
或类似的,因为这两种事件类型的架构完全不同。 How can I achieve this?我怎样才能做到这一点?
I think you can use the SchemaNameToTopic Single Message Transform to do this.我认为您可以使用SchemaNameToTopic Single Message Transform 来执行此操作。 By setting the topic name as the schema name this will propagate through to the name given to the created BigQuery table.通过将主题名称设置为架构名称,这将传播到为创建的 BigQuery 表提供的名称。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.