Skip to content

Better error message when joining original sql pre-aggregation to some non-aggregated data #1181

Open
@mkwatson

Description

@mkwatson

Describe the bug
you can't use original sql pre-aggregation and join to some non-aggregated data. When you try to, Cube attempts to join with the main, analytics database and the pre-agg database (which could be external).

To Reproduce

SELECT date_trunc('day', (cast("t1".report_date AS TIMESTAMP)::timestamptz AT TIME ZONE 'UTC')) "t1__report_date_day",
       sum("t1".sales) "t1__sales"
FROM ananlytics_db.t1 AS "t1"
LEFT JOIN stb_pre_aggregations_dev.companies_main_rc4lezhz_aljrstgp_1fnp97r AS "companies" ON "t1".company_id = "companies".id
WHERE (cast("t1".report_date AS TIMESTAMP) > $1::timestamptz)
  AND ("companies".company_id = $2)
GROUP BY 1
ORDER BY 1 DESC LIMIT 10000
ERROR:  relation "ananlytics_db.t1" does not exist

Expected behavior
Throw a warning with a descriptive message, not try to perform a query in the preagg db that will throw an exception.

Version:
0.20.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    Roadmap: 2021 Q1Cube.js team roadmap for Q1 of 2021.backend:serverIssues relating to Cube Core's Server

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions