本文介绍了如何通过HTTP接口将数据从文件插入Clickhouse?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过HTTP接口从文件向ClickHouse插入数据.CSV,JSON,TabSeparated,没关系.

I want to insert data to ClickHouse per HTTP-interface from file. CSV, JSON, TabSeparated, it's doesn't matters.

或使用 yandex/clickhouse-server 将数据插入Docker容器.

Or insert data to Docker-container uses yandex/clickhouse-server.

使用HTTP接口,例如:

Using HTTP-interface, for example:

cat source.csv | curl 'http://localhost:8123/?query=INSERT INTO table FORMAT CSV'

使用Docker容器,例如:

Using Docker-container, for example:

docker run -it --rm --link some-clickhouse-server:clickhouse-server yandex/clickhouse-client --host clickhouse-server {THERE SOME OPTIONS ABOUT INSERT FROM FILE}

谢谢.

推荐答案

curl'http://localhost:8123/?query = INSERT + INTO + TABLE(field)+ VALUES(data)%3b'

curl -d'将其插入到JSONEachRow {"dataTime":" 2020-12-19 03:00:00," transmit_bytes_max:123};中;'http://9.118.102.189:9200/?database=default'

curl'http://localhost:8123/?query = INSERT%20INTO%20TABLE%20FORMAT%20CSV'--data-binary @ source.csv

这篇关于如何通过HTTP接口将数据从文件插入Clickhouse?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-17 07:14