Pull workspace url and workspace name using databricks-sdk / programaticaly in notebook
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2025 09:17 AM
1. How could I pull workspace url (https://adb-XXXXX.XX.....net)
2. How could I get workspace name visible in top right corner.
I know that easies solution is dbutils.notebook.entry_point.... browserHostName but unfortunetly it is not working in job clusters. I tried use databricks-sdk WorkspaceClient and was able to get workspace id. like this
id = WorkspaceClient().get_workspace_id()
but still I am not able to get full workspace url from there. Same for workspace name.
- Labels:
-
Spark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2025 07:29 AM
Can you give this a shot? Not sure if you've a hard requirement of using SDK.
workspace_url = spark.conf.get('spark.databricks.workspaceUrl')
Getting name is more tricky. You could potentially get it from tags if there is a tagging strategy in place.