Model implicit joins fails on Native SQL with Dashboard filter unless FK relationship also setup on underlying table
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 49.3k
- Forks
- 6.8k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 653
Description
### Describe the bug
Using a Question based on a Native SQL Model with FK relationship on the Native SQL Model but not on the database column it maps to in a Dashboard with filters on other columns, fails in two ways.
If only filter selected, throws:
> ERROR middleware.catch-exceptions :: Error processing query: Column with source :source/implicitly-joinable is missing join alias
If another filter selected affecting same query, throws:
> ERROR middleware.catch-exceptions :: Error processing query: Cannot find matching FK Table ID for FK Field 14 "Product ID"
### To Reproduce
1. Create the native model
- New > Model > native query, Sample Database: `SELECT * FROM orders`
- Save as `ORDERS MODEL`
2. Edit Model Metadata and map the model columns to table fields
- For `PRODUCT_ID`
- Set **Database column this maps** to: Sample Database > Orders > **Product ID**
- Set **Column type** to: Foreign Key > Products > ID
- For `USER_ID`
- Set **Database column this maps** to: Sample Database > Orders > **User ID**
- Set **Column type** to: Foreign Key > People > ID
3. Create a Question on the model and Save it to a new Dashboard
- Simple Count on `ORDERS MODEL`
4. Edit Dashboard and add 2 filters:
- State - Mapped to User/People > State
- Category - Mapped to Products > Category
6. Save the dashboard.
7. Try one filter at a time, then both. All work as expected.
8. In Admin > Table Metadata, set Sample Database > Orders > Product ID to `No semantic type`
9. Refresh the dashboard
- State filter still works on its own
- Category filter doesn't work anymore
- Selecting both filters doesn't work anymore
### Expected behavior
Expect Model FK relationships to be picked up even if the database column it maps to doesn't have FK relationship configured.
### Logs
2026-09-19 00:38:44,829 DEBUG middleware.log :: POST /api/dashboard/11/dashcard/123/card/134/query 202 [ASYNC: completed] 56ms (22 DB calls) App DB connections: 0/10 Jetty threads: 4/50 (3 idle, 0 queued) (111 total active threads) Queries in flight: 1 (0 queued); sqlite DB 1 connections: 0/1 (0 threads blocked) {:metabase-user-id 1}
2026-09-19 00:38:48,090 ERROR middleware.catch-exceptions :: Error processing query: Column with source :source/implicitly-joinable is missing join alias
2026-09-19 00:38:48,092 DEBUG middleware.log :: POST /api/dashboard/11/dashcard/123/card/134/query 202 [ASYNC: completed] 48ms (27 DB calls) App DB connections: 0/10 Jetty threads: 4/50 (3 idle, 0 queued) (112 total active threads) Queries in flight: 0 (0 queued) {:metabase-user-id 1}
2026-09-19 00:39:21,176 ERROR middleware.catch-exceptions :: Error processing query: Cannot find matching FK Table ID for FK Field 14 "Product ID"
### Information about your Metabase installation
```JSON
v1.63.18
```
### Severity
common functionality broken, and workaround is to map the underlying column as a FK, but no indication in product that is the fix
### Additional context
Might be related to this one:
- https://github.com/metabase/metabase/issues/67475
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the native SQL model and dashboard-filter scenario described in the issue, including removing the underlying Product ID foreign-key semantic type. Compare the behavior with and without that metadata, then review related issue #67475. Done means filters work through the model FK relationship without either reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure, sql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100