Open zbodi74 opened 3 months ago
This seems like it's coming from confusion in MLv2 and/or the FE between querying/previewing "inside" the model and "outside" the model.
"Inside" the model, which is to say querying against the model's definition directly, the model's metadata overrides should not be applied. It should return the "rating"
column exactly as it comes from SQL, as a simple number.
"Outside" the model, the metadata overrides should be visible. That means the rating
native column is linked to the Reviews.RATING
Field, which has a custom mapping in the Table Metadata.
Describe the bug
Display issues and model corruption might occur when a native model references columns with custom mapped display values set in Table Metadata. These include:
To Reproduce
In Admin Settings / Table Metadata / Sample Database / Reviews, set up a custom mapping for the Rating column.
Create a native model which uses this table:
select distinct rating from reviews
, in the model metadata set 'Database column this maps to' to the correct source column. Save the model.The mapped values are displayed correctly.
Click on '...' / Edit query definition, the preview shows the mapped values
Refresh the preview (Cmd+Enter or click the refresh icon in the editor)
7(!) The non-mapped values are shown
Now click on cancel to stop editing the model 9(!) The column is displayed twice with mapped and unmapped values:
Reloading the page resolves this.
Still using the same model, go to '...' / Edit Metadata, update the description and Save Changes.
12(!) The model breaks:
Expected behavior
Each of the steps should work
Logs
No response
Information about your Metabase installation
Severity
Reported by a customer
Additional context
No response