databricks-demos / dbdemos

Demos to implement your Databricks Lakehouse
Other
255 stars 80 forks source link

uc-04-system-tables workspace ids should be friendly names #51

Open lotsahelp opened 11 months ago

lotsahelp commented 11 months ago

Workspace ids should be friendly names. See a wall of numbers doesn't let me easily determine which workspace this usage is for.

Thank you for this great resource.

noahsa-db commented 11 months ago

Hi @lotsahelp! Out-of-the-box system tables only emit workspace ids, not workspace names. If you create workspace id/ name mapping table, then you should be able to join it to the system table and use the workspace name field instead of workspace id. Here are two ways you can create a workspace id/ workspace name mapping table:

  1. Use the API to get your workspace ids and names, then store them in a workspace id/name mapping table. This is a better solution if you have many workspaces and they're often deleted & re-recreated.
  2. Manually create a workspace id/ name mapping table with your associated workspace ids and names. This is the quicker solution and works better if you have a small number of workspaces that aren't regularly deleted & re-created.

Hope this helps!

evogelpohl commented 11 months ago

@noahsa-db - I see on the Databricks REST API site how to get workspace names for AWS workspaces (https://docs.databricks.com/api/account/workspaces/list).

However, there seems to be no /workspaces/list endpoint for Azure workspaces. Though the accounts.azuredatabricks account-level admin site clearly lists all workspace names, regardless if they are tied to unity/metastores or not, so it seems possible.

Can you point us to an implementation example? @lotsahelp