clickhouse 批量删除分区


导入数据后发现大量分区字段插入错误,需要批量删除分区,发现不能批量操作,只能手写一个脚本分布执行。

shell 脚本如下:

ports="8888"
user=''
pwd=''
host=''
dbtable=''
drop_sql=(`curl -u $user:$pwd 'http://host:ports/?' -d "select  concat('alter table $dbtable drop partition',partition) as drop_sql 
from system.parts where `table` ='$dbtable'"`)

for i in "${drop_sql[@]}"

  do
  curl -u $user:$pwd 'http://'$host':'$port'/?' -d "$i;"  
  echo '============ successful==============='
  done

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM