问题
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