rittmananalytics / droughty

Droughty helps keep your workflow dry
https://droughty.readthedocs.io/en/latest/
MIT License
62 stars 6 forks source link

Cube can't find join paths between base and extension cubes #16

Open olivierdupuis opened 2 years ago

olivierdupuis commented 2 years ago

In cube_base.js, I have the following definition:

cube(`events_fct`, {
    sql: `select * from analytics.events_fct`,
    dimensions: {
        action_geo_country_code: {
            sql: `action_geo_country_code`,
            type: `string`,
            description: `not available`,
        },
        action_geo_country_name: {
            sql: `action_geo_country_name`,
            type: `string`,
            description: `not available`,
        },
        action_geo_full_name: {
            sql: `action_geo_full_name`,
            type: `string`,
            description: `not available`,
        },
        event_pk: {
            primaryKey: true,
            type: `string`,
            sql: `event_pk`,
            description: `not available`,
        },
        event_ts: {
            sql: `event_ts`,
            type: `time`,
            description: `not available`,
        },
        protest_fk: {
            sql: `protest_fk`,
            type: `string`,
            description: `not available`,
        },
    }
});

In cube_aggregates, I have the following definition:

cube(`events_fct_extended`, {
    sql: `select * from analytics.events_fct`,
    extends: events_fct,
    measures: {
        sum_of_action_geo_latitude: {
            sql: `action_geo_latitude`,
            type: `sum`,
        },
        sum_of_action_geo_longitude: {
            sql: `action_geo_longitude`,
            type: `sum`,
        },
        count_of_event_pk: {
            sql: `event_pk`,
            type: `count`,
        },
    }
});

When I try to run a query using a metric from events_fct_extended, segmented by a dimension from the events_fct cube, I have the following error.

Screen Shot 2022-05-30 at 13 34 53
olivierdupuis commented 2 years ago

Seems to actually be attributable to Cube itself. Looks like when you extend a cube, you cannot inherit its child's joins. https://cube-js.slack.com/archives/CC0403RRR/p1645444948953949 https://github.com/cube-js/cube.js/issues/2812

If that's the case, this issue can be closed and let's hope Cube fixes this, although it's been months since they've been notified of that issue.