Altinity / clickhouse-backup

Tool for easy backup and restore for ClickHouse® using object storage for backup files.
https://altinity.com
Other
1.25k stars 225 forks source link

FR: JSON output for CLI logs and data format #261

Closed vanyasvl closed 2 years ago

vanyasvl commented 3 years ago

It'll be great to add json output support for programmatically parse tool output.

Thanks.

Slach commented 3 years ago

JSON output already implemented in clickhouse-backup server mode unfortunately, currently is not so easy to add JSON to any output in CLI mode

k0t3n commented 2 years ago

@Slach but this one not actually JSON response, these are strings with JSON objects. Is it possible to implement real JSON API?

 [1] 10:45:21 $ curl -s localhost:7171/backup/list
{"name":"2022-07-03T10-24-02","created":"2022-07-03 10:24:04","size":503688895,"location":"local","required":"","desc":""}
{"name":"2022-07-03T10-43-06","created":"2022-07-03 10:43:07","size":503672129,"location":"local","required":"","desc":""}
Slach commented 2 years ago

@k0t3n this is JSONEachRow format actually, this format was choose for easy integration with clickhouse itself

you can setup

api:
  create_intergation_tables: true

and use clickhouse-client

SELECT * FROM system.backup_list FORMAT JSON;
INSERT INTO system.backup_actions(command) VALUES ('create_remote new_backup_name');
SELECT * FROM system.backup_actions FORMAT JSON;