【问题标题】:ClickHouse limitations in column manipulation列操作中的 ClickHouse 限制
【发布时间】:2021-08-12 17:02:27
【问题描述】:

我在 CH 文档中发现列操作有一些限制。

For tables that don’t store data themselves (such as Merge and Distributed), ALTER just changes the table structure, and does not change the structure of subordinate tables. For example, when running ALTER for a Distributed table, you will also need to run ALTER for the tables on all remote servers.

在这里我有问题..您有一些解决方案可以自动运行它吗?我在容器上创建了 4 台服务器,我不想在每台服务器上都登录并手动执行命令,例如 ALTER ... itd。

【问题讨论】:

    标签: sql olap clickhouse alter


    【解决方案1】:

    运行ALTER TABLE db.table ADD COLUMN ... ON CLUSTER 'cluster-name'

    基础Engine=ReplicatedMergeTree(...) 表的第一部分,Engine=Distributed(...) 表的第二部分

    【讨论】:

      【解决方案2】:

      嗯,只需公开端口并编写可以通过每个容器并运行命令的脚本。 ?

      在 Python ClickHouse 中有驱动程序。

      from clickhouse_driver import Client
      client = Client('localhost', port=8090, user='admin', password='admin')
      

      然后只遍历端口。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-10-12
        • 2019-04-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-01-04
        • 2022-01-19
        • 1970-01-01
        相关资源
        最近更新 更多