Skip to content

Instantly share code, notes, and snippets.

@dvu4
Created January 23, 2026 22:04
Show Gist options
  • Select an option

  • Save dvu4/2a098235a737a968aabf692ba51febbc to your computer and use it in GitHub Desktop.

Select an option

Save dvu4/2a098235a737a968aabf692ba51febbc to your computer and use it in GitHub Desktop.

Databricks billing

  1. Ask Databricks Admin to enable system billing After enabling, system.billing.usage and databricks billing billable-usage will work

  2. Get the workspace ID

workspace_id = spark.conf.get("spark.databricks.workspaceUrl").split(".")[0].replace("adb-", "")
print(f"Workspace ID: {workspace_id}")

Workspace ID: 7518301222765325

  1. CLI
databricks billing billable-usage --workspace-id 7518301222765325 --start-date 2026-01-01 --end-date 2026-01-23 --json | jq '.[] | select(.cluster_name=="GCI-Retail-01") | {cluster_name, dbus, estimated_cost}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment