Before you start
- Configure a Databricks data source and deploy static Cube YAML with public views. This workflow reads the latest successful deployed build, not unsaved IDE changes.
- If a Cube source uses a two-part
schema.tablename, setCUBEJS_DB_DATABRICKS_CATALOGfor that data source so Preview can resolve its catalog. Without it, those views are blocked. - Ask your Databricks administrator for a dedicated target catalog and schema for the
published Metric Views.
The identity configured on the Cube data source needs
CAN USEon its SQL warehouse,USE CATALOGandUSE SCHEMAon the target and source namespaces,SELECTon source relations, andCREATE TABLEon the target schema. The same identity must own any existing Cube-managed Metric View it needs to update. It owns the temporary views it creates for the access test. See the Databricks Metric View prerequisites and Metric View ownership guidance (AWS documentation; use the equivalent pages for Azure or Google Cloud). - Arrange target access for Databricks consumers separately. Publishing an object does not
grant them
SELECTon it or access to its catalog and schema. - Databricks evaluates access to the published object under Unity Catalog permissions, not Cube’s query-time authorization. A view with a Cube access policy, or one that references a cube with an access policy, is blocked from publication; Cube access policies are never transferred to Databricks. Review the Preview result and configure Databricks grants before exposing a target to consumers.
- Cube uses the data source credential server-side; you do not enter a second token in the browser. Preview returns generated YAML to authorized users for review.
Publish a view
The full publication flow requiresSchemaUpdate
deployment access. SchemaRead is enough to run and
inspect Preview, but not to save settings, test access, or sync.
1
Configure publication
Open your deployment’s Settings → Data Sources and edit the Databricks data source.
Expand Databricks Metric Views. Enter the target catalog and schema. Choose all public
views, selected views, or a name pattern; optionally add a target-name prefix. Turn publication
on and save. This alone does not start a write.
2
Preview the deployed model
Run Preview. Inspect every view’s generated YAML, source relation, warnings, and blocking
issues. It reads the deployed model and does not write to Databricks. Preview payloads and
results are retained for at most seven days; run it again if an older result is gone.
3
Test access
With a completed preview selected, run Test access. It checks source reads as well as
warehouse, target-schema, and temporary create/replace/drop access. The test creates and
cleans up a uniquely named temporary view; it does not change a final target.
4
Publish and inspect each result
Select Sync now. Review the result for each view in run history. Created,
Updated, and Unchanged are successful outcomes; Blocked, Rejected by Databricks,
and Write failed need investigation. A run can be Partial if some views succeeded and
others did not.
- The name pattern supports literals,
^,$, a bare.that matches any single character, and at most one.*wildcard. It is not a general regular expression and is limited to 128 characters. Review the matched views in Preview before syncing. - Each preview or sync resolves at most 128 views per data source, whether the scope is all, selected, or pattern. If all or pattern resolves more, preview and sync reject the request; narrow the scope and try again.
- A newly deployed view enters an all or matching pattern scope on the next manual sync. A selected scope changes only when you edit it.
- Renaming a view or target creates a new target and leaves the old one retained.
- Per-view target-name and root-source overrides are available through the configuration API, but are not editable in the card.
deletionPolicy to retain; omitting it also defaults
to retain. The older delete-managed value is deprecated but remains accepted for existing API
clients. It does not delete obsolete Metric Views; it currently behaves like retain.
Trigger publication from CI
Run publication from CI after a successful Cube deployment. First, configure All views, a dedicated target catalog and schema,retain, and publication enabled in Settings → Data
Sources. Run Preview and Test access before the first write. CI uses these saved settings;
the API call does not override the scope or destination.
Store a Platform API key with deployment SchemaUpdate access as
a CI secret. The recipe reads the saved settings, starts a run with their configurationVersion,
then polls the returned statusUrl. The start endpoint returns 202 with a runId, buildJobId,
optional commit, and root-relative statusUrl. It accepts an optional UUID idempotencyKey for
safe retries; another start while a run is active returns 409.
Run statuses are QUEUED, RUNNING, CANCELLING, COMPLETED, PARTIAL, FAILED, and CANCELLED.
To reject incompatible changes before writing, CI can preview
with {"dataSourceName": "default", "selectionMode": "all"} and inspect the result.
Require eligible views with no withheldMembers; avoid overlapping deployments because preview
and sync can resolve different builds.
This Bash step requires curl and jq. Set CUBE_API_URL to your tenant host without a trailing
slash, DEPLOYMENT_ID to the deployment that just succeeded, and CUBE_API_TOKEN to the CI secret.
Set EXPECTED_BUILD_JOB_ID if the deployment step returns one. The example uses the default
data source; URL-encode a different name in the path. Set SYNC_IDEMPOTENCY_KEY to a UUID unique
to this CI publication attempt and keep it unchanged across retries of that attempt. Do not reuse
it for a later pipeline run: the API would return the earlier run without publishing again. Set
MAX_POLLS to scale the wait for your view count and warehouse start-up time (default: 180
attempts, 10 seconds apart, plus request time).
retain so future delete-managed behavior cannot silently change the
CI policy. viewNames lists planned views; retained_obsolete means an obsolete target was left
in place. Publication-run views[].outcome values are unchanged, created, updated, blocked,
validation_failed, publish_failed, retained_obsolete, and deleted_obsolete; these differ
from preview outcomes. The recipe accepts only the successful, retain-safe outcomes.
incompleteViewCount counts published views whose withheldMembers list is nonempty; requiring
zero rejects definitions missing measures.
Failed checks do not roll back writes. Inspect views[] for errors or withheldMembers. List
older runs with
GET /api/v1/deployments/{deploymentId}/databricks-metric-view-integrations/{dataSourceName}/syncs
and request cancellation of an active run with DELETE {statusUrl}. Cancellation stops further
writes but does not undo completed ones. curl --fail exits with code 22 and omits the response
body on HTTP errors; on 409, inspect run history before retrying.
What can be published
The Preview result is the authority for your deployed model. This preview release supports static YAML, one Databricks data source per published view, scalar dimensions, common aggregates and supported calculated measures, and conservative many-to-one equality joins. The target uses Databricks Metric View YAML 1.1. These categories reflect the current preview release. Capabilities may change between releases, so run a new Preview after a Cube upgrade.- Supported — a static view with a clear root source and representable dimensions, measures, and joins. Review the generated YAML, then test access and sync.
- Warning — behavior-neutral metadata Databricks cannot represent, or a fan-out-unsafe measure
withheld as
CUBE_MEMBER_WITHHELD. Review the exact difference before accepting publication; for a withheld measure, publish it from a view rooted at its own cube.
- Dynamic JavaScript, TypeScript, or Jinja models, or unflattened
extends: use static YAML and flatten inherited definitions before publishing. - A Cube access policy on the view or a referenced cube: keep that governed view in Cube; the policy cannot be transferred to a Databricks Metric View.
- Mixed data sources or an ambiguous root dataset: use one data source and a clear root.
- A two-part
schema.tablesource withoutCUBEJS_DB_DATABRICKS_CATALOG: set that variable for the selected Databricks data source and preview again. - Non-equality, cyclic, or one-to-many joins: simplify the join. For
CUBE_VIEW_JOIN_NOT_REPRESENTABLE, root the view at the many-side cube. - Unsupported expressions or types, or multi-stage, window, or ranking calculations: simplify the model or keep that view in Cube.