clickhouse data insertion through API

。_饼干妹妹 提交于 2020-07-19 18:42:24

问题


I can get data from the clickhouse database using get method, Similarly i want to insert data using post method . Is their anyway to do like that


回答1:


Modification of data in HTTP interface is allowed using POST method only.

Check out example given below on Clickhouse official documentation.

echo 'INSERT INTO t VALUES (1),(2),(3)' | curl 'http://localhost:8123/' --data-binary @-

https://clickhouse.yandex/docs/en/interfaces/http_interface/

Edit With Post Image.

Screenshot of postman and clickhouse client after insert




回答2:


Try this: Initially, change <readonly> Tag in user.xml of click house-server from read-only mode to read & write mode by changing <readonly> tag value to 0(zero).

Url:http://localhost:8123/?query=INSERT%20INTO%20db_name.table_name%20FORMAT%20Values Body: ('1','2','3') // Body should be in tuple format.

Refer:https://clickhouse-docs.readthedocs.io/en/latest/settings/query_complexity.html#readonly



来源:https://stackoverflow.com/questions/52549221/clickhouse-data-insertion-through-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!