@Danish11052000
A feasible workaround is to use the Databricks Account Workspaces API to fetch the GCP project_id alongside workspace_id. The workspace API schema exposes it under cloud_resource_container.gcp.project_id. Reference
url = f"https://accounts.gcp.databricks.com/api/2.0/accounts/{ACCOUNT_ID}/workspaces"
workspaces = requests.get(
url,
headers={"Authorization": f"Bearer {TOKEN}"}
).json()
rows = [
(
str(w["workspace_id"]),
w.get("workspace_name"),
w.get("cloud_resource_container", {})
.get("gcp", {})
.get("project_id")
)
for w in workspaces
]
df = spark.createDataFrame(
rows,
["workspace_id", "workspace_name", "project_id"]
)

Then persist in a mapping table like workspace_project_map and enrich billing as:
SELECT
u.*,
m.project_id
FROM system.billing.usage u
LEFT JOIN finops.workspace_project_map m
ON u.workspace_id = m.workspace_id
At present, system.access.workspaces_latest provides workspace metadata such as workspace_id, workspace_name, workspace_url, and status but doesn't expose the GCP project_id as mentioned in docs too.
So the practical approach for now could be API โ mapping table โ billing enrichment, while also watching for Databricks to add project_id directly to a system table in the future.