Used below query to attach one partition in ClickHouse.
alter table a_status_2 attach partition '20210114' from a_status_1;
How to attach multiple partitions in ClickHouse?
Used below query to attach one partition in ClickHouse.
alter table a_status_2 attach partition '20210114' from a_status_1;
How to attach multiple partitions in ClickHouse?
How to attach multiple partitions in ClickHouse?
No way to do it automatically.
You can generate SQL script using system.detached_parts
select concat('alter table `',table, '` attach part id '||partition_id||';')
from system.detached_parts
where database = 'xxx' and table = 'yyy'
Or https://gist.github.com/den-crane/5ae44ec04961ec62286835c8798e2728
let i=1;for f in `ls -1` ; do echo $i $f;((i++)); echo "alter table A.d attach part '$f';"|clickhouse-client ; done