metabase
metabase copied to clipboard
Trend Visualization fails with query editor's generated native query
Describe the bug I used the Query Editor to create a mongodb question to visualize a trend. It works as expected in the Query Editor however when I convert it to Native Query and execute the generated query, the Trend visualization fails with this message "Group by a time field to see how this has changed over time".
Logs No errors in logs.
To Reproduce Steps to reproduce the behavior:
- Select a MongoBD database
- Select Database table
- Filter, summarize and select a date group field
- Sort and limit by 2
- Visualize as Trend. This works
- View native query
- Convert this question to native query
- Select database table
- Run query
- Trend visualization fails to display and is disabled in the list of visualizations. Error message, "Group by a time field to see how this has changed over time".
Expected behavior I expected the native query to work as it did using the Query Editor since the editor generated the query.
Screenshots
Information about your Metabase Installation: { "browser-info": { "language": "en-US", "platform": "Linux x86_64", "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36", "vendor": "Google Inc." }, "system-info": { "file.encoding": "UTF-8", "java.runtime.name": "OpenJDK Runtime Environment", "java.runtime.version": "11.0.16.1+1", "java.vendor": "Eclipse Adoptium", "java.vendor.url": "https://adoptium.net/", "java.version": "11.0.16.1", "java.vm.name": "OpenJDK 64-Bit Server VM", "java.vm.version": "11.0.16.1+1", "os.name": "Linux", "os.version": "5.19.0-76051900-generic", "user.language": "en", "user.timezone": "GMT" }, "metabase-info": { "databases": [ "h2", "mongo" ], "hosting-env": "unknown", "application-database": "mysql", "application-database-details": { "database": { "name": "MySQL", "version": "8.0.28" }, "jdbc-driver": { "name": "MariaDB Connector/J", "version": "2.7.6" } }, "run-mode": "prod", "version": { "date": "2022-09-02", "tag": "v0.44.3", "branch": "release-x.44.x", "hash": "7d50282" }, "settings": { "report-timezone": "America/Barbados" } } }
Severity This issue is sever as I'm unable to find a work around and cannot use a refined mongodb query to display the trend.
Additional context I'm running metabase from a docker container.
This may be the same issue as #13208
Similar problem here. We just upgraded from an old version of MB (0.32 to 0.46). Trends based on native MongoDB queries used to work without problems on 0.32. After the upgrade, we have the "Group by a time field to see how this has changed over time" message on the same queries (no changes).
What's disturbing is that the field is recognised as a date field.
I suspect this is fixed. Here's a loom trying to recreate and I can't seem to do it. I'm wondering if https://github.com/metabase/metabase/issues/13208 resolved it.
@markbastian have you tried reproducing it on 44 or 45?
Repro on v0.45.4. I'm going to try again on v1.48.2.
I am able to reproduce this on v1.48.2 as shown here.