Metabase: Saved Questions Not Loading Data from Linked Tables

Created on 30 Oct 2019  路  4Comments  路  Source: metabase/metabase

Describe the bug
Saved questions do not show linked tables in Filter and Summarize options, but new questions do. In existing saved questions, filters and group options show an empty field in the editor where the linked table field was. When trying to add a new filter or summarize in the question, the linked tables do not show up.

When a new question is made that queries the same thing as an existing one, the linked tables and their fields show up as expected. When the new question is saved and the page is refreshed in the browser the linked tables and fields do not show up.

Logs
Server log from the time of loading a question using a linked table:
10-30 16:52:47 DEBUG middleware.log :: GET /api/user/current 200 3.2 ms (3 DB calls) Jetty threads: 6/50 (5 idle, 0 queued) (316 total active threads) Queries in flight: 0 10-30 16:52:47 DEBUG middleware.log :: GET /api/session/properties 200 5.5 ms (1 DB calls) Jetty threads: 5/50 (5 idle, 0 queued) (316 total active threads) Queries in flight: 0 10-30 16:52:47 DEBUG middleware.log :: GET /api/database 200 18.0 ms (3 DB calls) Jetty threads: 7/50 (5 idle, 0 queued) (316 total active threads) Queries in flight: 0 10-30 16:52:47 DEBUG middleware.log :: GET /api/card/1493 200 10.7 ms (6 DB calls) Jetty threads: 8/50 (5 idle, 0 queued) (316 total active threads) Queries in flight: 0 10-30 16:52:47 DEBUG middleware.log :: GET /api/setting 200 1.0 ms (0 DB calls) Jetty threads: 8/50 (5 idle, 0 queued) (316 total active threads) Queries in flight: 0 10-30 16:52:47 DEBUG middleware.log :: GET /api/alert/question/1493 200 1.8 ms (1 DB calls) Jetty threads: 6/50 (4 idle, 0 queued) (316 total active threads) Queries in flight: 0 10-30 16:52:47 DEBUG middleware.log :: GET /api/table/10775/query_metadata 200 23.2 ms (11 DB calls) Jetty threads: 6/50 (4 idle, 0 queued) (316 total active threads) Queries in flight: 0 10-30 16:52:47 DEBUG middleware.log :: GET /api/collection/178 200 7.3 ms (4 DB calls) Jetty threads: 6/50 (4 idle, 0 queued) (316 total active threads) Queries in flight: 0 10-30 16:52:48 DEBUG middleware.log :: GET /api/database 200 1.1 s (24 DB calls) Jetty threads: 5/50 (4 idle, 0 queued) (316 total active threads) Queries in flight: 0

To Reproduce
Steps to reproduce the behavior:

  1. Go to a saved question whose source table has other tables linked to it via FKs in the Data Model settings
  2. See that Filters and Summarize options that use fields on the linked tables are empty
  3. Click on plus buttons for Filter or Summarize to add a new Filter or Summarize and see that no linked tables show up

Expected behavior
Saved questions that use tables linked via FKs should be able to access the linked tables

Screenshots
Creating a new question from Memberships table with a filter and group by using linked Recipients table:
image

Saving the new question:
saved_question_after_save

Reloading the saved question or accessing from its URL:
image

The Recipient column in the Memberships table is set in the Data Model settings to be a foreign key to the Users table:
image

Information about your Metabase Installation:
{
"browser-info": {
"language": "en-US",
"platform": "MacIntel",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.4+11-post-Ubuntu-1ubuntu218.04.3",
"java.vendor": "Ubuntu",
"java.vendor.url": "https://ubuntu.com/",
"java.version": "11.0.4",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.4+11-post-Ubuntu-1ubuntu218.04.3",
"os.name": "Linux",
"os.version": "5.0.0-1021-gcp",
"user.language": "en",
"user.timezone": "Etc/UTC"
},
"metabase-info": {
"databases": [
"mysql",
"sqlserver",
"googleanalytics",
"postgres"
],
"hosting-env": "unknown",
"application-database": "postgres",
"run-mode": "prod",
"version": {
"date": "2019-10-07",
"tag": "v0.33.4",
"branch": "release-0.33.x",
"hash": "9559406"
},
"settings": {
"report-timezone": "UTC"
}
}
}

Severity
We use linked tables a lot in our Metabase reports and they don't work anymore. Others may be experiencing this as well.

.Frontend P1 QueryinGUI Bug

Most helpful comment

Reproduced this on our stats instance, but this behavior seems to correct itself if you start a new question using the same data the saved question uses, then go back and open that saved question again. This seems to fix things for the rest of your session, but the incorrect behavior will resume if you start a new session (i.e. close the tab and open a new tab).

Opening up the breakout column selection menu doesn't list the selected FK column:

image

You also can't select a new breakout referencing a FK-linked column:

image

Same problem with filters; can't reference a FK-linked column:

image

This same behavior happens in Simple mode as well:

image

All 4 comments

Reproduced this on our stats instance, but this behavior seems to correct itself if you start a new question using the same data the saved question uses, then go back and open that saved question again. This seems to fix things for the rest of your session, but the incorrect behavior will resume if you start a new session (i.e. close the tab and open a new tab).

Opening up the breakout column selection menu doesn't list the selected FK column:

image

You also can't select a new breakout referencing a FK-linked column:

image

Same problem with filters; can't reference a FK-linked column:

image

This same behavior happens in Simple mode as well:

image

@mazameli Any time frame on this? Our Metabase users are reporting this super frequently and are confused why filters don鈥檛 work.

Thanks!

I'm no longer able to reproduce this on master. Not sure what might have fixed this. Should we add a test for this in any case?

I have reproduced some of this on master (missing fields, not specifically linked tables) - #11495.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mazameli picture mazameli  路  3Comments

tlrobinson picture tlrobinson  路  3Comments

remydavid picture remydavid  路  3Comments

kristian-elder picture kristian-elder  路  3Comments

bobwaycott picture bobwaycott  路  3Comments