Created 01-16-2023 07:55 AM
Hi All,
I need to drop around 5000 tables from a schema - schemaDB, am using below script, tableNameList list contains all the 5000 tables names which I need to drop from the schema, but as the loop calling beeline process each time for each drop, the process to drop all the 5000 tables is taking lot of time, do we have another option where we can acheive it fastly.
for tableName in $(cat tableNameList)
do
beeline -u "jdbc:hive2://server1.com:10000/default;principal=hive/server1.com@.com;" -e "drop table schemaDB.$tableName" >> $drop.log
done
Thanks praKodi
Created 01-18-2023 12:52 AM
hi @prakodi You can use below string 5000 times
beeline -u "jdbc:hive2://server1.com:10000/default;principal=hive/server1.com@.com;" -e "drop table schemaDB.$tableName1" -e "drop table schemaDB.$tableName2" -e " "drop table schemaDB.$tableName3" ................ >> $drop.log
Please mark this as RESOLVED,if your queries are answered.
Created 01-18-2023 01:00 AM
If you want to delete all the tables in a database in one go
DROP DATABASE database_name CASCADE;
Created 01-23-2023 02:18 PM
@prakodi Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future., thanks!
Regards,
Diana Torres,