We are looking to migrate to managed tables using ALTER TABLE fq_table_name SET MANAGED
During migration process we need to have ability to switch between external & managed tables & vice versa.
UNSET MANAGED works for 14 days.
But I'm unable to just delete the converted managed table & rebuild as external exact same external location.
Once table is deleted spark.catalog.tableExists(fq_table_name) returns false as expected.
While trying to recreate it using below code returns error that table does not exist instead of creating table.
df_final.write.format("delta")
.mode("append")
.option("path","Original_External_Storage_Path")
.saveAsTable(runtime_contract.entity_full_name)
same process works if the table starts its life as managed.
i.e. I can have managed table x deleted & created as external.