[SQL API] Generic rewrite error for Metabase-generated joins between Cube models

Environment

  • Cube Core: cubejs/cube:v1.6.29

  • Metabase: Cloud

  • Data source: BigQuery

  • Connection: Cube PostgreSQL SQL API

Problem

Metabase’s visual query builder generates joins between Cube tables using matching key columns. For example:

SELECT
  f.group_code,
  d.category_label,
  COUNT(DISTINCT f.key_token) AS item_count
FROM public.cube_fact AS f
LEFT JOIN public.cube_dim AS d
  ON f.key_token = d.key_token
GROUP BY 1, 2;

The Cube models declare this relationship as many-to-one:

cubes:
  - name: cube_fact
    joins:
      - name: cube_dim
        relationship: many_to_one
        sql: "{CUBE}.key_token = {cube_dim}.key_token"

However, Cube 1.6.29 fails to rewrite the SQL generated by Metabase and returns:

ERROR: Error during rewrite: Can't detect Cube query and it may be not supported yet.

The same failure occurs when attempting to join the two models from Metabase’s interface or SQL editor using the declared key.

Expected behavior

Ideally, Cube recognizes equality on keys from a declared relationship and translates the join into the modeled Cube join. If this SQL shape is unsupported, Cube should return an actionable error explaining the supported SQL API join syntax.

Questions/Problem

How can two cube models be joined via Metabase interface or the SQL API ?

Note: Cube’s SQL API documentation describes joins using __cubeJoinField or views. This report requests clarification on compatibility with Metabase-generated SQL and a more specific error for unsupported join shapes.