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