cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Linking Workspace IDs to Names in Billing Schema

TravisBrowne
New Contributor II

Hi everyone,

We recently enabled UC and the Billing system table to monitor our usage and costs. We've successfully set up a dashboard to track these metrics for each workspace. The usage table includes the workspace_id, but I'm having trouble finding a way to map these IDs to their corresponding workspace names. compassmobiletree

Since the System Tables feature is still in preview and not all tables are available yet, I'm curious if there's any plan to include workspace names in the "usage" table in the near future. If not, what would be the best approach to create a table that links workspace_id with workspace_name, considering I don't have access to the Databricks account level?

1 REPLY 1

andreji
New Contributor II

I got this from their older version of the dashboard. 

dbdemos uc-04-system-tables


When everything is executed, go to your graph in the dashboard, click three dots in the top right, select in my case "View dataset:usage_overview" then paste/modify sql code as below. This will hardcode the workspace name into your dashboard.

 

-- parse workspaces json
workspace as (
  select explode(
    map_entries(from_json('{"2049501200185xyz":"namexyz","1944008075660xyz":"name2nyz","8293066424636xyz":"name3nyz"}', 'map<string,string>'))
  ) as kvp,
  kvp['key'] as workspace_id,
  kvp['value'] as workspace_name
),
-- apply date filter