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