I need to move a hive table from one database to another. How can I do that?
Since 0.14, you can use following statement to move table from one database to another in the same metastore:
use old_database; alter table table_a rename to new_database.table_a
The above statements will also move the table data on hdfs if table_a
is a managed table.
create external table new_db.table like old_db.table location '(path of file in hdfs file)';
if you have partition in table then you have to add partition in new_db.table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With