This project is mirrored from https://github.com/metabase/metabase.
Pull mirroring updated .
- Dec 11, 2023
-
-
Alexander Solovyov authored
- Dec 09, 2023
-
-
Cam Saul authored
-
Anton Kulyk authored
-
- Dec 08, 2023
-
-
Cam Saul authored
Use `sorted-set` for `locales.clj` so order doesn't change every time we add a new language (#36617)
-
Cam Saul authored
Co-authored-by:
metamben <103100869+metamben@users.noreply.github.com>
-
metamben authored
-
Luiz Arakaki authored
-
John Swanson authored
There's a fun bug in H2: https://github.com/h2database/h2database/issues/3942 To reproduce: - create a table, then - create a view based on the table, then - modify the original table, then - generate a snapshot The generated snapshot has the `CREATE VIEW` *before* the `CREATE TABLE`. This results in a view that can't be queried successfully until it is recompiled. Our workaround is to recompile ALL views immediately after we restore the app DB from a snapshot.
-
Luis Paolini authored
* Add title to funnel chart that became a bar chart Simple fix for https://github.com/metabase/metabase/issues/36227 * Fix whitespaces * Add prettier on the file * add specs --------- Co-authored-by:
Aleksandr Lesnenko <alxnddr@gmail.com>
-
-
Aleksandr Lesnenko authored
-
Braden Shepherdson authored
This was introduced by #36443.
-
Ryan Laurie authored
-
Braden Shepherdson authored
If the aggregation is based on `:case` or another non-column value, errors were being thrown trying to generate refs.
-
shaun authored
-
Jeff Bruemmer authored
-
Ngoc Khuat authored
-
Braden Shepherdson authored
These were broken because `lib.js/pivot-types` was returning CLJS keywords rather than strings. Also makes applying drill-thrus less noisy (`log/info` -> `log/debug`). Unskips the FE integration tests for pivot drills. Fixes #33559.
-
Ngoc Khuat authored
-
Cal Herries authored
-
- Dec 07, 2023
-
-
Mark Bastian authored
* Apply column formatting to CSV exports This PR applies the same formatting logic to CSV exports as it does to pulse bodies (e.g. HTML). Formerly, there were two related formatting paths: - `metabase.query-processor.streaming.common/format-value`, which is from a protocol that takes an object and returns a string. It is what was used to export csv data. It applies no actual formatting, only converts objects to strings. - `metabase.pulse.render.body/get-format`, which builds a formatter from an optional time zone, column metadata, and visualization settings. This formatter takes a string and formats it. It was only used for rendering inline artifacts, such as embedded HTML in emails. The first function is insufficient to format row data as it is unaware of the column metadata and viz settings. We need to use that data everywhere data is exported in a uniform way. The solution is to lift `get-format` from `metabase.pulse.render.body` to a more common location (`metabase.pulse.render.common` in this PR step, but needs to be moved out of the pulse code to be a more shared concern) and use it everywhere artifacts are generated. For csv export, this was achieved as follows in `metabase.query-processor.streaming.csv`: ```clojure (defmethod qp.si/streaming-results-writer :csv [_ ^OutputStream os] (let [writer (BufferedWriter. (OutputStreamWriter. os StandardCharsets/UTF_8)) formatters (atom {})] (reify qp.si/StreamingResultsWriter (begin! [_ {{:keys [ordered-cols results_timezone]} :data} viz-settings] (swap! formatters (constantly (zipmap ordered-cols (map (fn [col] (p.common/get-format results_timezone col viz-settings)) ordered-cols)))) (csv/write-csv writer [(map (some-fn :display_name :name) ordered-cols)]) (.flush writer)) (write-row! [_ row _row-num cols {:keys [output-order]}] (let [[ordered-row ordered-cols] (if output-order (let [row-v (into [] row) cols-v (into [] cols)] [(for [i output-order] (row-v i)) (for [i output-order] (cols-v i))]) [row cols])] (csv/write-csv writer [(map (fn [c r] (let [formatter (@formatters c)] (formatter (common/format-value r)))) ordered-cols ordered-row)]) (.flush writer))) (finish! [_ _] ;; TODO -- not sure we need to flush both (.flush writer) (.flush os) (.close writer))))) ``` The formatters for each column are build in the `begin!` function and then looked up in each `write-row!`. The existing `format-value` is used to produce a string then passed into our looked up column formatter. Note that the new unit tests simulate a pulse and grab the provided temp files as attachments and analyzes those for correctness. This should work in a CI environment so long as the test process has permission to both write attachments to the temp directory and read those attachments back out. Also note that these tests can be slow (but not terribly so). Primary changes: - `metabase.email.messages` - fix spelling - `metabase.pulse.render.body` - move `get-format` out of this ns - `metabase.pulse.render.common` - move `get-format` into this ns - `metabase.query-processor.streaming.csv` - new logic to apply pulse renderer formatting to csv exports - `metabase.pulse.pulse-integration-test` - adding unit tests One TODO before a final commit of this PR is to move the `get-format` logic out of a pulse ns into something more general. Ultimately, it would be nice if this was a common capability used by both BE and FE. * Refactoring formatting code for common utility This PR refactors `metabase.pulse.render.common` to `metabase.formatter` as this is code we want applied to several locations, not just in pulses. It also updates references to these nses and the consistent alias. A key observation of this formatting code, and reason for the refactor, is that it is "metabase-aware" in that it takes into account metadata columns and visualization settings when building formatters rather than just being a simple generic date or number formatter. This is a common code path that should be used any time we are rendering static assets and could potentially be used as common FE code with future development. Moves: - `metabase.pulse.render.common` to `metabase.formatter` - `metabase.pulse.render.datetime` to `metabase.formatter.datetime` - `metabase.pulse.render.common-test` to `metabase.formatter-test` - `metabase.pulse.render.datetime-test` to `metabase.formatter.datetime-test` * Ordering consistent aliases in kondo config * Rebase fix to use formatter ns in streaming.csv * Adding `metabase.formatter` require. * Updating require alias on new test.
-
lbrdnk authored
* Use date instead of timestamp * Update logging and add code for local testing * Rename datetime to date
-
Ryan Laurie authored
-
Anton Kulyk authored
-
Anton Kulyk authored
-
Uladzimir Havenchyk authored
-
Anton Kulyk authored
This reverts commit 2af32bbc.
-
shaun authored
* fix types * swap unit test step order
-
Nicolò Pretto authored
feat:: white labeling option for help link
-
Case Nelson authored
* [MLv2] drop-stage-if-empty * Addressing PR comments
-
Mark Bastian authored
* Apply column formatting to CSV exports This PR applies the same formatting logic to CSV exports as it does to pulse bodies (e.g. HTML). Formerly, there were two related formatting paths: - `metabase.query-processor.streaming.common/format-value`, which is from a protocol that takes an object and returns a string. It is what was used to export csv data. It applies no actual formatting, only converts objects to strings. - `metabase.pulse.render.body/get-format`, which builds a formatter from an optional time zone, column metadata, and visualization settings. This formatter takes a string and formats it. It was only used for rendering inline artifacts, such as embedded HTML in emails. The first function is insufficient to format row data as it is unaware of the column metadata and viz settings. We need to use that data everywhere data is exported in a uniform way. The solution is to lift `get-format` from `metabase.pulse.render.body` to a more common location (`metabase.pulse.render.common` in this PR step, but needs to be moved out of the pulse code to be a more shared concern) and use it everywhere artifacts are generated. For csv export, this was achieved as follows in `metabase.query-processor.streaming.csv`: ```clojure (defmethod qp.si/streaming-results-writer :csv [_ ^OutputStream os] (let [writer (BufferedWriter. (OutputStreamWriter. os StandardCharsets/UTF_8)) formatters (atom {})] (reify qp.si/StreamingResultsWriter (begin! [_ {{:keys [ordered-cols results_timezone]} :data} viz-settings] (swap! formatters (constantly (zipmap ordered-cols (map (fn [col] (p.common/get-format results_timezone col viz-settings)) ordered-cols)))) (csv/write-csv writer [(map (some-fn :display_name :name) ordered-cols)]) (.flush writer)) (write-row! [_ row _row-num cols {:keys [output-order]}] (let [[ordered-row ordered-cols] (if output-order (let [row-v (into [] row) cols-v (into [] cols)] [(for [i output-order] (row-v i)) (for [i output-order] (cols-v i))]) [row cols])] (csv/write-csv writer [(map (fn [c r] (let [formatter (@formatters c)] (formatter (common/format-value r)))) ordered-cols ordered-row)]) (.flush writer))) (finish! [_ _] ;; TODO -- not sure we need to flush both (.flush writer) (.flush os) (.close writer))))) ``` The formatters for each column are build in the `begin!` function and then looked up in each `write-row!`. The existing `format-value` is used to produce a string then passed into our looked up column formatter. Note that the new unit tests simulate a pulse and grab the provided temp files as attachments and analyzes those for correctness. This should work in a CI environment so long as the test process has permission to both write attachments to the temp directory and read those attachments back out. Also note that these tests can be slow (but not terribly so). Primary changes: - `metabase.email.messages` - fix spelling - `metabase.pulse.render.body` - move `get-format` out of this ns - `metabase.pulse.render.common` - move `get-format` into this ns - `metabase.query-processor.streaming.csv` - new logic to apply pulse renderer formatting to csv exports - `metabase.pulse.pulse-integration-test` - adding unit tests One TODO before a final commit of this PR is to move the `get-format` logic out of a pulse ns into something more general. Ultimately, it would be nice if this was a common capability used by both BE and FE. * Updated formatter state The rows in qp.si/StreamingResultsWriter are ordered, so there should be no need to do a lookup by col. We should just be able to map the ordered-formatters (using the same order as the cols) with the ordered row data. * Updating tests in `metabase.query-processor.streaming-test` to reflect new csv formatting. * Updated fomatter for tests and consistency This updates several tests (metabase.query-processor.streaming.csv-test) to reflect the new and correct behavior of using a common csv formatter as well as update the formatting code to correctly handle relational types and datetimes. * require fmt * Updating metabase.pulse.render.body-test to reflect `:type/DateTime` formatting. * Updating sqlite test * Updating report-timezone-test to reflect new CSV rendering * Fixing e2e test
-
Jerry Huang authored
-
Braden Shepherdson authored
This was missed from #36443. Fixes #33558.
-
metamben authored
Fixes #36459. Also makes sure that legacy to pMBQL works and that simple value expressions can be named.
-
Anton Kulyk authored
* Use `minWidth` instead of `width` * Reserve left padding for the settings icon
-
Gustavo Saiani authored
-
Alexander Solovyov authored
-
- Dec 06, 2023