Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Referencing a model in a SQL query won't use the persisted model #25516

Closed
paoliniluis opened this issue Sep 20, 2022 · 4 comments · Fixed by #25610
Closed

Referencing a model in a SQL query won't use the persisted model #25516

paoliniluis opened this issue Sep 20, 2022 · 4 comments · Fixed by #25610
Assignees
Labels
Priority:P2 Average run of the mill bug Querying/Cache Querying/Models aka Datasets Type:Bug Product defects
Milestone

Comments

@paoliniluis
Copy link
Contributor

paoliniluis commented Sep 20, 2022

Describe the bug
When referencing the model in a SQL query ( {{# ..}} ), then the query won't use the persisted model but rather will go to the actual table

Logs
NA

To Reproduce

  1. Enable model caching (ensure that the model is being cached by checking the DB)
  2. create a model (e.g. select * from people), cache it
  3. then create a new GUI question and use the model, see that Metabase pulls the data from the cache (even when using the /dataset endpoint)
  4. now create a SQL question, and reference the model as it would be a saved question with its id (e.g. select * from {{ # x }}, being x the id of the model), save it and run it. See that the model is pulled from the source tables rather than from the cache

Expected behavior
Cached models should always be pulled from the cache

Screenshots
Using GUI question
image
image

Using SQL question
image
image

Information about your Metabase Installation:

  • Your browser and the version: Brave latest
  • Your operating system: Pop 22.04
  • Your databases: Postgres
  • Metabase version: 1.44.2
  • Metabase hosting environment: Docker
  • Metabase internal database: Postgres

Severity
P2?

Additional context
Reported by a customer

@Mohammad-Rahmati
Copy link

Hi @dpsutton ,
I think the problem remains unsolved. Take a look at the following screen shots. The first image is a question referencing a model, and the second image is the model loading performance.

image
image

@flamber
Copy link
Contributor

flamber commented Sep 27, 2022

@Mohammad-Rahmati Your screenshots are showing you're running v44.2. The issue is fixed in upcoming v45.0

@Mohammad-Rahmati
Copy link

@flamber Thanks for the prompt reply! When do you think the new update goes live?

@flamber
Copy link
Contributor

flamber commented Sep 27, 2022

@Mohammad-Rahmati I don't know. Within a couple of months.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:P2 Average run of the mill bug Querying/Cache Querying/Models aka Datasets Type:Bug Product defects
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants