ansible-collections / community.clickhouse

Ansible Community ClickHouse Collection
GNU General Public License v3.0
5 stars 5 forks source link

Execution of sql scripts #26

Open aleksvagachev opened 7 months ago

aleksvagachev commented 7 months ago
SUMMARY

It may not be convenient to use the clickhouse_client module to create tables or more complex queries. Maybe it's worth implementing a module for reading and executing scripts, or adding script execution functionality to clickhouse_client?

ISSUE TYPE
Andersson007 commented 6 months ago

@aleksvagachev i don't know how it works in clickhouse but if they support something like dump / restore in other RDBMS maybe we should create a module for that (i don't like this to be like in c.postgres/mysql where it's done via _db modules). E.g. possible interface

- name: Dump data
  community.clickhouse.clickhouse_data:
    state: dump
    file: /path/to/file

- name: Restore data
  community.clikhouse.clickhouse_data:
    state: restore
    file: /path/to/file

the module name, the args names, and choices can be discussed but the idea should be clear. I would like to mix it with clickhouse_db module and this would solve your issue. But i'm not an expert. What do you think?

aleksvagachev commented 6 months ago

@Andersson007 I have not encountered dump/restore in clickhouse. I'm not sure that there is such a thing. There is clickhouse-backup and other additional utilities. Maybe try to consider their implementation or come up with something of your own from scratch? In this issue, I wanted to have functionality similar to the postgresql_script module.

Andersson007 commented 6 months ago

@aleksvagachev sure, feel free to add the module. I would avoid adding any return values though as it's often gonna execute more than 1 query. It was a great source of pain in c.postgres. We could add it later if needed. Feel free to create an issue and work on it or put help wanted if you wouldn't like to do it yourself. UPDATE: we could use this issue:)