Join aliases support
- Dominant language
- Rust
- Stars
- 20.8k
- Forks
- 2.1k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 181
Description
Currently, there's a way to _alias_ a cube by [extending](https://cube.dev/docs/product/data-modeling/reference/cube#extends) it. It can be useful for defining multiple joins to the same cube and using it in [join paths](https://cube.dev/docs/product/data-modeling/concepts/working-with-joins#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.
```yaml
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: https://github.com/cube-js/cube/issues/8989
It's currently planned for February 2026.
Contributor guide
Assessment
This issue has not been assessed yet.