Created 07-12-2017 07:10 PM
DROP DATABASE IF EXISTS userdb CASCADE;
By using CASCADE, tables in userdb will be deleted first and then the database will be dropped.
Is it safe to use cascade for Dropping the Hive database?
Is there any best practice?
Created 07-12-2017 07:11 PM
Created 07-12-2017 09:42 PM
DROP DATABASE will fail if the database is not empty. To drop the tables in the database as well, use DROP DATABASE ... CASCADE
Created 07-12-2017 11:54 PM
@Sridhar Reddy I know, CASCADE will help in dropping the database with tables in it. Is this an only way or are there any best practices?
Created 07-13-2017 04:49 AM
Yes, this is the only way to drop the database along with tables inside it. I haven't faced any issues till now but I;m not sure of best practices
Created 07-13-2017 04:49 AM
Yes, this is the only way to drop the database along with tables inside it. I haven't faced any issues till now but I;m not sure of best practices
Created 07-13-2017 04:36 PM
@Sridhar Reddy Using cascade for dropping DB will delete the entire directory of DB in given HDFS location and also data of other DB which are in/under that location of dropped DB. So it is not recommended to use CASCADE for dropping DB.
Created 07-17-2017 06:07 PM
If the idea is to drop the database and all tables within, then the db directory from HDFS is sure to be removed. Is the use case to remove the tables within than to remove the database and it's directory structure?
Created 07-18-2017 07:23 PM
@Sindhu Yes, idea is to drop the database and all tables within and to remove the db directory from HDFS too.
Created 07-26-2017 06:08 AM
Then, you need to run 'Drop database cascade'.