-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Models query fails when a field is remapped with Custom value #23449
Comments
I did some debugging and I think this happens because when creating a question that has a custom-mapping, the This virtual field is problematic because some of our middleware assumes columns inside Also note that this problem happens with joins too, as demonstrated in here |
…rtual" fields by the associated query's `table` method (#25109) * Add merge method to Field * add new virtual table utils + tests * Use new utils in implementation of Structured/NativeQuery table methods + remove unneeded Dimension logic * let all Questions return dependentMetadata * Fix types related to query.table() potentially returning null * Fix updateQuestion tests * Remove unused Dimension imports * Fix issue resolving rootTable on queries based on virtual tables * Fallback to the nested card table stored in the Metadata instance * Make the nested card Table the main driver in returning fields for nested cards + other misc fixes * more tweaks related to cloned Tables, source queries * Don't clobber metadata if something is already there (like a method named 'metadata') * Fix for nested native query * Don't use real table for source query * Update table code to use the actual nested card table fields instead of doing merge logic * Skip an e2e test * Workaround for getting Dimensions from joins * Update arg name * Try removing the Table fetch from Question's dependentMetadata method * Don't rerun query when converting question to model * Fix for source query not showing 'previous results' * Fix unit tests * Update models e2e tests not to wait on query * Unskip repro for #23449 * make sure a join's joinedQuery is not a dataset/model * use createQuestion in e2e test * don't use Question redux dispatch method for updating * split test cases * Add comment
Since this is a symptom of my favourite millstone #36185, it can't really be fixed directly. I'm triaging this as "Hard" even though this individual issue would probably be fixed in passing by that deeper change. |
Describe the bug
When a field is using custom remapping via Data Model, then creating Models will make the query fail.
Workaround: Use a database view, or try using SQL with manual remapping (case when ...)
To Reproduce
Error executing query: Column \"source.Rating\" not found;
, which is the second rating field in the query, but it is using the display name as identifier instead of the underlying column name.Full stacktrace
Information about your Metabase Installation:
Tested 0.43.3
Additional context
Feels related to #22519, though remapping and casting are two different things.
The text was updated successfully, but these errors were encountered: