8 hours ago
We have tried to rename a table
Ex: alter rename tablea to tableb
while we checked the table b properties we are seeing the tableb location is being pointed to tablea location.
7 hours ago
Hi @Rajasaiharish ,
Just like @Khaja_Zaffer correctly suggested - renaming table doesn't change its location. If you want to change location as well use following command:
ALTER TABLE table_name SET LOCATION path_to_the_new_location
7 hours ago - last edited 7 hours ago
Hello @Rajasaiharish ,
The above is expected by design.ALTER TABLE RENAME TO
updates only the table name in the catalog.The underlying Delta log + data files remain in the original storage location
Try setting the location to a new location
ALTER TABLE table_name SET LOCATION path_to_the_new_location
or drop and recreate or run a CRTAS as a solution
8 hours ago
Hello @Rajasaiharish
Thats expected behaviour
so if you run DESCRIBE EXTENDED tableb; you might see that it could point the same location as tablea.
we are just renaming not changing the location right?
7 hours ago
In general in CDP environment,we just rename the table and underlying location also gets changed
7 hours ago
Hi @Rajasaiharish !
Yes, that's correct! In hive/CDP (HMS word) rename operation (ALTER TABLE RENAME
) automatically renames the directory in HDFS to match because Hive Metastore directly controls both the metadata and the storage path.
But in Databricks, UC separates logical metadata (catalogue/schema/table) from physical storage.
7 hours ago
Hi @Rajasaiharish ,
Just like @Khaja_Zaffer correctly suggested - renaming table doesn't change its location. If you want to change location as well use following command:
ALTER TABLE table_name SET LOCATION path_to_the_new_location
7 hours ago - last edited 7 hours ago
Hello @Rajasaiharish ,
The above is expected by design.ALTER TABLE RENAME TO
updates only the table name in the catalog.The underlying Delta log + data files remain in the original storage location
Try setting the location to a new location
ALTER TABLE table_name SET LOCATION path_to_the_new_location
or drop and recreate or run a CRTAS as a solution
7 hours ago
So after step alter table a to table b we need to run alter table table name set location ? And we did not faced this in our cdp environment
Passionate about hosting events and connecting people? Help us grow a vibrant local communityโsign up today to get started!
Sign Up Now