问题描述
我们需要将数据从postgres插入clickhouse。 postgres中的字段之一具有json类型。 在Clickhouse中,此字段具有Nullable(String)类型。 对于插入数据,我们使用 Airflow ClickHouse插件:
data = postgress_hook.get_records(query)
clickhouse_hook.run(
sql="INSERT INTO "+ self.clickhouse_tgt_table +" values",parameters=data
)
但是在插入过程中出现错误:
'dict' object has no attribute 'encode'
我们应该使用哪种Clickhouse类型来存储json数据?
解决方法
'dict'对象没有属性'encode'
此消息不是来自CH服务器,而是来自python驱动程序。