更新时间:2024-10-18 GMT+08:00
分享

删除ClickHouse表

本章节介绍删除ClickHouse表样例代码。

删除在创建ClickHouse表中创建的副本表和分布式表。

示例代片段参考如下:

private void dropTable(String databaseName, String tableName, String clusterName) throws Exception {
    String dropLocalTableSql = "drop table if exists " + databaseName + "." + tableName + " on cluster " + clusterName;
    String dropDisTableSql = "drop table if exists " + databaseName + "." + tableName + "_all" + " on cluster " + clusterName;
    ArrayList<String> sqlList = new ArrayList<String>();
    sqlList.add(dropLocalTableSql);
    sqlList.add(dropDisTableSql);
    util.exeSql(sqlList);
}

相关文档