简体   繁体   English

从 Kafka json 消息到雪花表

[英]From Kafka json message to Snowflake table

I am trying to implement a Snowflake Sink connector so that can i load messages coming to a Kafka topic directly to an appropriate Snowflake table.我正在尝试实现一个 Snowflake Sink 连接器,以便我可以将进入 Kafka 主题的消息直接加载到适当的 Snowflake 表中。 So far, I could only get to the point of loading the raw json into a table with two columns (RECORD_METADATA and RECORD_CONTENT).到目前为止,我只能将原始 json 加载到具有两列(RECORD_METADATA 和 RECORD_CONTENT)的表中。 My goal would be to directly load the json messages into an appropriate table by flattening them.我的目标是通过展平将 json 消息直接加载到适当的表格中。 I have the structure of what the table should be, so I could create a table and directly load into that.我有表应该是什么的结构,所以我可以创建一个表并直接加载到该表中。 But I need a way for the load process to flatten the messages.但我需要一种方法让加载过程扁平化消息。

I have been looking online and through the documentation, but haven't found a clear way to do this.我一直在网上和通过文档查找,但还没有找到一个明确的方法来做到这一点。 Is it possible or do I have to first load the raw json and then do transformations to get the table that I want?有可能还是我必须先加载原始 json 然后进行转换以获得我想要的表?

Thanks谢谢

You have to load the raw JSON first then you can do transformations.您必须先加载原始 JSON 然后才能进行转换。

Each Kafka message is passed to Snowflake in JSON format or Avro format.每个 Kafka 消息都以 JSON 格式或 Avro 格式传递给 Snowflake。 The Kafka connector stores that formatted information in a single column of type VARIANT. Kafka 连接器将该格式化信息存储在 VARIANT 类型的单个列中。 The data is not parsed, and the data is not split into multiple columns in the Snowflake table.数据未解析,数据未拆分为 Snowflake 表中的多个列。

For more information you can read here有关更多信息,您可以在此处阅读

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM