Is there a way to programatically retrieve a workspace name ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 03:10 PM
Is there a spark command in databricks that will tell me what databricks workspace I am using? I’d like to parameterise my code so that I can update delta lake file paths automatically depending on the workspace (i.e. it picks up the dev workspace name when in dev and will pick up the prod workspace name in prod). Is this possible?
- Labels:
-
Databricks workspace
-
Workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 08:26 PM
You may run the below in a notebook within the workspace:
dbutils.entry_point.getDbutils().notebook().getContext().toJson()
The output contains:
browserHostName - is the workspace name
orgId - is the workspaceID
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 11:54 PM
Thanks Navya! But this doesn't work for me on a High Concurrency cluster. It seems that toJson() isn't whitelisted.

