Skip to content

Join aliases support #10265

@igorlukanin

Description

@igorlukanin

Currently, there's a way to alias a cube by extending it. It can be useful for defining multiple joins to the same cube and using it in join paths in pre-aggregations and views.

We can simplify aliasing by introducing the new alias parameter for joins. When this parameter is set on a join definition, the joined cube as added to the global namespace with cubes and views, meaning that all aliases should be unique within the data model. If multiple joins are defined to the same cube, they both must define aliases.

cubes:
  - name: sales_order_lines
    sql: sales_order_lines

    joins:
      - name: customers
        relationship: one_to_one
        sql: "{CUBE.buyer_id} = {customers}.id"
        alias: buyers

      - name: customers
        relationship: many_to_one
        sql: "{CUBE.reviewer_id} = {customers}.id"
        alias: reviewers
        
        # Calendar cube use case
      - name: date_dimensions
        relationship: many_to_one
        sql: "{CUBE.created_at} = {date_dimensions}.date_val"
        alias: date_dimensions__created_at
        
      - name: date_dimensions
        relationship: many_to_one
        sql: "{CUBE.shipped_at_key} = {date_dimensions}.date_key"
        alias: date_dimensions__shipped_at

Join aliases will also be useful for calendar cubes: #8989

It's currently planned for February 2026.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions