metabase / metabase/metabase

Allow cross joins in the Query Builder with multiple join keys

Open
#29,036 0 comments 2 reactions 0 assignees View on GitHub
Querying/GUI Querying/Processor Type:New Feature
Dominant language
Clojure
Stars
49.3k
Forks
6.8k
Avg merge
1d 13h
Merged PRs (30d)
653

Description

**Is your feature request related to a problem? Please describe.**
As a user, I want to build queries featuring cross joins.

For example, suppose I have a list of actions per company, and I want to sum them up per day, and **include zeroes** the only way to do this properly is by using a date spine (unless I'm mistaken ?)

```sql
select
company_name,
week,
count(*),
from date_spine_week
cross join companies as company
left join actions as action on action.date_week = date_spine_week.week
and company.name = action.company_name
group by week, company_name
```

**Describe the solution you'd like**
A way to select cross join in the query builder, and the ability to pick one join key for each cross joined item

**Describe alternatives you've considered**
SQL Query. It actually works, but then we are losing the "automatic filters" that you can get on dashboards

**How important is this feature to you?**
It would make life much easier when computing periodic stats, when we need to include zeroes systematically

**Additional context**
Example of displayed visualization using a graph

![Screenshot 2023-03-08 at 17 36 08](https://user-images.githubusercontent.com/7388889/223773538-d21870cf-3dea-42a3-8be3-5089a5e5cc5c.png)

Contributor guide

Open the contributing guide

Research direction

No files or tests are named in the issue. Start by tracing the Query Builder entry point for join configuration and compare it with the SQL cross-join example; done means the builder supports cross joins with multiple join keys while preserving dashboard automatic filters.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure, sql
Domain
backend-api-design, data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.