Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2024 11:24 AM
As the file still in the dbfs you can just recreate the reference of your tables and continue the work, with something like this:
db_name = "mydb"
from pathlib import Path
path_db = f"dbfs:/user/hive/warehouse/{db_name}.db/"
tables_dirs = dbutils.fs.ls(path_db)
for d in tables_dirs:
table_name = Path(d.path).name
spark.sql(f"""CREATE TABLE IF NOT EXISTS {table_name}
LOCATION '{d.path}'
""")