cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Pull workspace url and workspace name using databricks-sdk / programaticaly in notebook

CaptainJack
New Contributor III

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. 

1 REPLY 1

AbhaySingh
Databricks Employee
Databricks Employee

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.