yesterday
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.
yesterday
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
yesterday - last edited yesterday
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
yesterday
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?
yesterday
In general in CDP environment,we just rename the table and underlying location also gets changed
yesterday
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.
yesterday
Thats correct, in databricks you need to mention in detail sir.
Again my solution is not the solution marked. I need to improve solution details.
yesterday
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
yesterday - last edited yesterday
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
yesterday
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