简体   繁体   English

Clickhouse将json数据插入字符串列

[英]Clickhouse insert json data to string column

We need to insert data from postgres to clickhouse.我们需要将数据从 postgres 插入到 clickhouse。 One of the field in postgres has json type. postgres 中的字段之一具有 json 类型。 In clickhouse this field has Nullable(String) type.在 clickhouse 中,此字段具有 Nullable(String) 类型。 For inserting data we use Airflow ClickHouse Plugin :对于插入数据,我们使用Airflow ClickHouse 插件

 data = postgress_hook.get_records(query)     
 clickhouse_hook.run(
                    sql="INSERT INTO "+ self.clickhouse_tgt_table +" values",
                    parameters=data
 )

But we have an error during inserting:但是我们在插入过程中出现错误:

'dict' object has no attribute 'encode'

What clickhouse type should we use to store json data?我们应该使用什么类型的 clickhouse 来存储 json 数据?

'dict' object has no attribute 'encode' 'dict' 对象没有属性 'encode'

this message is not from CH server, but from a python driver.此消息不是来自 CH 服务器,而是来自 python 驱动程序。

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

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