Create Tables From Folder in Databricks


You have a folder in ADLS, where all subfolders need to be a table in databricks.


def recreate_tables(container, db, subpath="", engine="delta"):
  tables ="abfss://{container}{subpath}")
  for table in tables:
    name ="/")
    print(f"making sure table '{name}' exists at '{table.path}'")
    spark.sql(f"create table if not exists {db}.{name} using {engine} location '{table.path}'")


recreate_table("mycontainer", "mydb", "subfolder")

Em, excuse me! Have Android 📱 and use Databricks? You might be interested in my totally free (and ad-free) Pocket Bricks . You can get it from Google Play too: Get it on Google Play

Thanks! You can always email me or use contact form for more questions/comments etc.