Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to rename a table without re creating it

Tags:

I didn't find a RENAME option to alter table name. I have a case that I must rename a table, and the only way is to select with result to new table. this query cost money, and taking long time for no reason.

It is especially painful when I need to rename a nested table, so I must export, need to even work on the result set in order to import it back.

Any way that I am missing? anything coming soon?

like image 375
user1516770 Avatar asked May 26 '13 03:05

user1516770


People also ask

How will you rename a table in hive without using alter command?

ALTER TABLE table_name RENAME TO new_table_name; This statement lets you change the name of a table to a different name. As of version 0.6, a rename on a managed table moves its HDFS location as well. (Older Hive versions just renamed the table in the metastore without moving the HDFS location.)


1 Answers

There is no rename option, but there is a copy operation, which uses a fast snapshot process. This doesn't incur any additional charges other than the additional cost of storage (of course you can delete the original table so you only get charged for the storage once).

You can do this in the BigQuery by clicking on the table name and the dropdown arrow next to the table name, then selecting 'copy table'. Alternately you can use the bq cp command in the bq command-line tool.

like image 112
Jordan Tigani Avatar answered Sep 19 '22 17:09

Jordan Tigani