Migrate from Cube

What to export from Cube, how Cube cubes, views, measures, segments and access policies map to Malloy, and how to rebuild them with the modeling agent, for Cube developers and analytics engineers

A Cube data model moves into Credible through the modeling agent. The agent reads the exported model files as reference material and drafts the Malloy model from them, checking its proposals against your data. Expect to review the translations more closely than for Looker or Power BI, which have dedicated skills.

Comparing the two products first? See Credible vs. Cube.

What to Export

  • The data model files: the YAML or JavaScript files under your Cube project's model folder, with cubes and views.
  • Generated models: if cubes are generated with JavaScript or Jinja, also export the compiled result, for example the response from Cube's REST API metadata endpoint (/v1/meta). The source files alone may not show every member.
  • Usage: the queries and dashboards people rely on, to set the scope.

How Cube Concepts Map to Malloy

CubeMalloyNotes
Cube with sql_tablesource: over connection.table('schema.table')
Cube with sqlA query-based source, or a table built upstream
View (join_path, includes)source: with joins that exposes a chosen set of fields
joins with relationship: many_to_one / one_to_onejoin_one:
relationship: one_to_manyjoin_many:
{CUBE}.columnA plain column reference
Dimensiondimension:
primary_key: trueprimary_key: on the source
Time dimensionA date or timestamp field, truncated with .day, .month, .year
Measure type: countcount()
type: count_distinctcount(field)count(field) is distinct in Malloy
type: sum, avg, min, maxsum(), avg(), min(), max()
type: numberA measure built from other measures
Measure filtersmeasure { where: condition }Filtered aggregate
rolling_window measureA calculate: window function in a query
SegmentA Boolean dimension used in where:, or a named view
title, description#(doc) tag
formatRender tags such as # currency, # percent
public: falseinternal: or private:Choose by why it was hidden
access_policy, queryRewrite#(access_filter) or #(authorize)Review by hand
pre_aggregationsNothing to convertSee Materialization and Performance if a source needs to be persisted

Steps

  1. Set up a local modeling directory with cred init (Cred CLI). Put the model files in a subfolder such as cube/ and add it to .credignore.
  2. Ask the agent to build the model, naming the folder and the domain: "Build a model of our orders domain using the Cube model in cube/ as prior art."
  3. Review the proposed sources, joins and fields.
  4. Compare the key numbers against Cube with the same filters, as described in Prove Parity. Compare against raw data rather than a pre-aggregation, which may be stale.
  5. Publish, then rebuild the dashboards people use as reports or data apps.

What Needs Manual Review

  • Dynamic models. Cubes generated in JavaScript or Jinja, or with context variables in their SQL. Check the generated output, not only the template.
  • Access policies and queryRewrite. Member-level and row-level rules written in code don't translate mechanically. Re-create them with access rules.
  • Multi-tenant setups. Per-tenant schemas or data sources selected at query time need a deliberate design in Credible.
  • Rolling windows. Check that each one returns the same values at the time grains people use.
  • Dashboards built on Cube. Not converted.

Next Steps

On this page