how to create catalog
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 04:33 AM
Hi ,
I am trying to create catalog and database its not allowing databricks , please suggest .
Here my code .
base_dir = "/mnt/files"
spark.sql(f"CREATE CATALOG IF NOT EXISTS dev")
spark.sql(f"CREATE DATABASE IF NOT EXISTS dev.demo_db")
first i need to create catalog then after under catalog i want to create database.
Thank You .
Praveen.
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 04:49 AM
Hi @PraveenReddy21 ,
What error do you get? Do you use Unity Catalog or Hive metastore?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 08:17 AM
Hi ,
Please find the below error
AnalysisException: [RequestId=2e102048-fdde-4293-8cfe-8f0d866e5a1c ErrorClass=INVALID_STATE] Metastore storage root URL does not exist. Please provide a storage location for the catalog (for example 'CREATE CATALOG myCatalog MANAGED LOCATION '<location-path>'). Alternatively set up a metastore root storage location to provide a storage location for all catalogs in the metastore.
File <command-2451673260852784>, line 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
I got a similar error trying create a catalog with "databricks.sdk" library I resolved it add the parameter "storage_root":
w.catalogs.create(name=c.name, storage_root='s3://databricks-workspace-bucket/unity-catalog/426335709')
In my case all catalog are MANAGED, so I took this value of previous catalog created.

