Data

Databricks

Data and AI platform where many companies train, serve and query their models. Roiva reads Databricks spend from the account's billing system tables, broken down by product (model serving, jobs, SQL and more) and by the custom tags on endpoints, jobs and clusters. And your own metric queries read the figures you already model in Unity Catalog, such as claims cycle days, as monthly readings of the metrics your value formulas use.

What gets synced

Roiva writes these metric observations on each sync. Reference the key in a value formula to use this data in your ROI calculations.

Billing

databricks.cost.total_spend Total Spend currency
databricks.cost.product_spend Product Spend currency
Common use cases
  • Feed a metric from your own tables with a versioned SQL query, so claims, underwriting or operations figures aren't typed in by hand
  • Track monthly Databricks spend, including model serving and foundation model usage
  • Count one initiative's AI spend by the custom tag on its serving endpoints, jobs or clusters
  • Match products such as MODEL_SERVING or JOBS to initiatives when resources aren't tagged
  • Use monthly spend observations in value formulas to calculate net ROI
How to connect

You connect Databricks from inside Roiva, so you need a Roiva workspace first. Sign in to connect it now. New to Roiva? Take the free assessment and create your workspace at the end, or request an invite.

  1. In Databricks: As a workspace admin, open Settings, then Identity and access, then Service principals, and add one for Roiva. On its Secrets tab, generate an OAuth secret with the longest lifetime Databricks allows (730 days). Under Scope, choose Other APIs and add the sql scope only: Roiva asks for a token for SQL and nothing else, and Databricks won't issue one to a secret without it. Copy the client ID and the secret, which Databricks shows only once. Note when it expires: the connection stops syncing then, until a new secret is pasted in
  2. In Databricks: Give the service principal Databricks SQL access on its Configurations tab, and Can use on the SQL warehouse Roiva should run on, under that warehouse's Permissions (skip this if All workspace users already has Can use there). A small serverless warehouse is enough
  3. In Databricks: As a metastore admin, run the setup script below in the SQL editor, with the service principal's client ID in place of <client-id>. It lets the service principal read the billing tables and nothing else. Unity Catalog must be on for the workspace. If Databricks answers that you don't have MANAGE on Catalog 'system', you aren't a metastore admin: an account admin makes you one in the account console, under Catalog, then the metastore, then Configuration
  4. Back in Roiva: Enter the Workspace URL, the address you use for Databricks, and the SQL Warehouse ID from the warehouse's Connection details. Paste the service principal's credentials into API Key / Secret as client_id:client_secret, and save the connection
  5. Back in Roiva: The connection page checks each step as the service principal and gives the SQL for anything still missing. Once it's all ticked, click Test Connection
  6. Back in Roiva: To count one initiative's spend, give its serving endpoints, jobs, clusters or warehouses a custom tag (roiva-initiative=invoice-ai, say), and enter the tag key and value on the initiative's link. The connection page checks each tagged link too
  7. In Databricks: To feed metrics from your own tables, create a view for each in the schema the script makes (workspace.roiva_metrics, or the catalog you chose), which the service principal may read and nothing else. Then in Roiva, set Metrics Schema to that catalog.schema in this connection's settings, and add a query for each metric on its Metric Queries tab
Setup script
-- Run in the Databricks SQL editor as a metastore admin, with the service
-- principal's client ID (its application ID) in place of <client-id>.
GRANT USE CATALOG ON CATALOG system TO `<client-id>`;
GRANT USE SCHEMA ON SCHEMA system.billing TO `<client-id>`;
GRANT SELECT ON SCHEMA system.billing TO `<client-id>`;

-- For metric queries: a schema of views the service principal may read
-- and nothing else. On a SQL warehouse a view reads its tables with its
-- owner's rights, so the service principal needs no grant on them.
-- A new workspace's catalog is named workspace; an older one's is
-- often main. Use yours in place of workspace.
CREATE SCHEMA IF NOT EXISTS workspace.roiva_metrics;
GRANT USE CATALOG ON CATALOG workspace TO `<client-id>`;
GRANT USE SCHEMA ON SCHEMA workspace.roiva_metrics TO `<client-id>`;
GRANT SELECT ON SCHEMA workspace.roiva_metrics TO `<client-id>`;
Tips for capturing value
  • Roiva prices usage at Databricks' list prices (system.billing.list_prices), so an account with negotiated discounts sees Roiva's figures above its invoice
  • Each sync and each connection check runs a few short queries on the SQL warehouse; a serverless warehouse that stops after a few idle minutes keeps that to cents
  • Serving endpoints pass their custom tags to billing, so tagging an endpoint is enough to count its AI spend for an initiative
  • Custom tag keys and values are case-sensitive, and only usage from after a resource was tagged carries the tag
  • Azure Databricks spend also appears on the Azure bill, so connecting both shows it twice; Roiva keeps Databricks spend under its own metrics rather than adding it to cloud cost
  • A metric query returns one row per month, with period and value columns (and entity for a breakdown). Roiva reads only those columns, versions the query's text, keeps the rows each version returns, and asks the workspace's query history that every statement it ran was a SELECT
  • Grants to groups the service principal is in, such as all account users, reach its queries too, and every workspace lets all account users read the samples catalog. The connection page's check lists only what's granted to it directly
Need help?

Email hello@roiva.ai with what you're seeing, and you'll hear back within one business day.

Databricks

Start with the free AI ROI exposure assessment, then connect Databricks once your workspace is set up.

Get your exposure report → Sign in to connect