Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Jun 26, 2024
  2. Jun 25, 2024
  3. Jun 24, 2024
  4. Jun 22, 2024
  5. Jun 21, 2024
    • adam-james's avatar
      Disable Pivot Export Post Processing Step (#44561) · 998b28cd
      adam-james authored
      This PR disables the 'make exports look pivoted' post processing step for csv and xlsx exports.
      
      This is in response to a reported issue that Large Pivot Table downloads are failing entirely: #44556
      
      A more hollistic fix and improvement to the post processing feature will be worked on, so the post processing code is
      left untouched in this PR.
      
      The dynamic vars in the csv and xlsx namespaces each default `false` and disable the export from running any post
      processing. The var should remain `false` until we've got a plan for these types of exports, and there is no way for
      users (either through ENV or UI) to change this, so the feature is effectively disabled.
      Unverified
      998b28cd
    • Cam Saul's avatar
      Set `useLocalSessionState=true` for MySQL DW connections [PERFORMANCE BOOST] (#44509) · 89f12e7c
      Cam Saul authored
      * Set `useLocalSessionState=true` for MySQL DW connections
      
      * Fix GH issue number
      
      * Test fixes :wrench:
      
      * Lint fix :wrench:
      Unverified
      89f12e7c
  6. Jun 20, 2024
  7. Jun 19, 2024
    • Case Nelson's avatar
      fix: populate param-fields for named fields on public dashboards (#44440) · 523ea248
      Case Nelson authored
      
      * Update e2e test
      
      * Update e2e test
      
      * fix: populate param-fields for named fields on public dashboards
      
      * Add name to public hydration
      
      * Add tests
      
      * Add tests
      
      * Fix tests
      
      ---------
      
      Co-authored-by: default avatarAlexander Polyankin <alexander.polyankin@metabase.com>
      Unverified
      523ea248
    • Cal Herries's avatar
      Exclude native query matches in search scoring when the search should exclude... · 3f788bba
      Cal Herries authored
      Exclude native query matches in search scoring when the search should exclude native queries (#43982)
      
      Co-authored-by: default avatarChris Truter <crisptrutski@users.noreply.github.com>
      Unverified
      3f788bba
    • adam-james's avatar
      User parameter value json fix (#44420) · bbde99dd
      adam-james authored
      
      * UserParameterValue transforms wrapped to properly escape string vals
      
      The `json-in` and `json-out` functions used for toucan model transforms do not perform any string escaping logic. This
      makes sense as we don't want to make assumptions about the shape of data flowing in/out of the db. But, this did mean
      that for the User paramter values table, string values were causing an error to be logged. This doesn't break
      anything, as the function will still correctly return the string, but it can clutter up logs.
      
      So, this PR wraps all incoming values in a map and unwraps it for outgoing values.
      
      * Add migration to wrap existing user param values with ::wrapper key
      
      Since the in/out transform for UserParameterValues is updated, we need to migrate any existing values to have this wrapping.
      
      * Simplify the solution to the problem.
      
      Since we're already getting what we need from the json-in/json-out *except* that it's logging a parse error, we can
      create a json-out that works the same way (tries to parse and returns the string as-is if it fails) without logging an
      error at all.
      
      * take away the arg and keywordize inside the json-out fn
      
      * remove irrelevant comment
      
      Signed-off-by: default avatarAdam James <adam.vermeer2@gmail.com>
      
      * Add a little more test coverage for different value types
      
      * faster test thanks to Dan!
      
      * Add a comment about the data being tested
      
      ---------
      
      Signed-off-by: default avatarAdam James <adam.vermeer2@gmail.com>
      Unverified
      bbde99dd
    • adam-james's avatar
      XLSX Pivot Table Downloads have 'Native' Pivot Table (#43791) · 89bdaa2f
      adam-james authored
      * XLSX Pivot Table Downloads have 'Native' Pivot Table
      
      Addresses: #2473
      
      The xlsx downloads work fine for regular tables. However, on Pivot Table downloads, the resulting file isn't pivoted
      and is formatted somewhat strangely (it contains additional rows related to totals, has an extra 'pivot-grouping'
      column).
      
      Now, the downloaded xlsx file contains 2 sheets:
      - the data sheet containing the question's rows unpivoted. If you were constructing a pivot table yourself, you would
      probably start with this shape of data.
      - the pivot sheet containing a 'native' Pivot table whose reference points to the data on the data sheet, and whose
      columns, rows, and values align with the cols, rows, and measures set up in Metabase
      
      * Silly typo!
      
      * Exported Pivot uses correct aggregation (sum, count, stddev, avg, min, max)
      
      * data for pivot exports now also uses the formatting
      
      * Add a test asserting that a pivot table exists in the xlsx file
      
      * add-row! is a method dispatching on sheet class
      
      * remove unnecessary hint
      
      * address review feedback:
      
       - consolidate the aggregation function key fns into one function in the .xlsx namespace
         this was moved out of postprocessing so that the xlsx specific fns don't litter the post processing namespace at
         this time
      
       - clean up an unnecessary destructiring inside the native-pivot function
       - don't shadow 'name' inside the body of a fn
      
      * Add tests that confirm zero-col and zero-row situations work
      
      * Consolidate the atoms used to store pivot rows/options
      Unverified
      89bdaa2f
    • Chris Truter's avatar
    • Braden Shepherdson's avatar
      [QP] Fix breakouts on a nested model (#44418) · 3ccf4d41
      Braden Shepherdson authored
      Fixes #43993 for real.
      
      The earlier fix #44182 was needlessly restricting the
      "nominal refs" check to fields which were using numeric IDs,
      when really any match on nominal refs is valid.
      Unverified
      3ccf4d41
    • Braden Shepherdson's avatar
    • Alexander Solovyov's avatar
      [openapi] fix query parameter detection and add default/description handling (#44239) · f284a522
      Alexander Solovyov authored
      Also OpenAPI generation now handles parameter renaming, like in `{c :count}` destructuring.
      Unverified
      f284a522
    • Ngoc Khuat's avatar
      Metabase channel (#43924) · 613318f7
      Ngoc Khuat authored
      Unverified
      613318f7
  8. Jun 18, 2024
    • adam-james's avatar
      Pivot Tables with no Pivot Columns should still download (#44329) · 37abc084
      adam-james authored
      * Pivot Tables with no Pivot Columns should still download
      
      Fixes #44159
      
      Pivot Tables can still be valid without columns, and therefore the download should respect such a query and be
      successfully exported.
      
      In this PR, the postprocessing of pivot results into 'visual pivot' exports for csv takes into account the zero-column
      configuration and the download no longer fails.
      
      * add a test to confirm that zero cols and >1 measures works as well
      
      * Handle the case where there are zero pivot-rows.
      
      This is a similar problem to the zero pivot-cols case, just with rows.
      
      The app actually doesn't render these tables correctly, but that's a separate frontend bug
      Unverified
      37abc084
    • John Swanson's avatar
      Fix missing `can_restore` on collections (#44287) · d6873e86
      John Swanson authored
      I'd fixed the `can_restore` on non-collections to always be present, but
      forgot about fixing it for collections as well.
      Unverified
      d6873e86
    • Nemanja Glumac's avatar
      Fix metabase lib returning the string "null" as the drill through value (#44234) · bc78552d
      Nemanja Glumac authored
      
      * Convert drill-through (CLJ) values to JS
      
      * Convert the drill-through `:null` to an actual `null`
      
      Resolves #44232
      
      * Use new function in `filter-drill-details`
      
      * display-info->js should check for nil before seqable?
      
      * fix js object comparison
      
      * Add test for the `drill-value->js` function
      
      * Simplify the test
      
      * Fix the JS object equality in the test
      
      ---------
      
      Co-authored-by: default avatarAlexander Solovyov <alexander@solovyov.net>
      Unverified
      bc78552d
  9. Jun 17, 2024
    • Alexander Polyankin's avatar
    • Case Nelson's avatar
      Change run to make-run in process-query-for-card (#44244) · ea9dfd1d
      Case Nelson authored
      * Change run to make-run in process-query-for-card
      
      Fixes #44160
      
      There were two levers where a card could change how it was run.
      
      `qp` this is basically `qp/process-query` with some optional userland
      flags and constraints marked on the passed in query.
      In the case of pivot tables in the
      `/pivot/:card-id/query` endpoints it was `qp.pivot/process-query`
      
      'run' this defaults to a streaming response that takes the `qp` param
      and `export-format` and passes a query to qp. Most often this is
      overriden to not stream the response.
      
      Unfortunately, if `run` is overwritten, then `qp` is thrown away, and
      the caller who overrides `run` must determine the correct `qp` to use.
      
      However, when running `process-query-for-dashcard` it is difficult to properly set
      `qp` for all of the dashcards without doing card lookups. So [this commit](https://github.com/metabase/metabase/blob/release-x.50.x/src/metabase/query_processor/card.clj#L230-L232) did a check to swap the runner in the presence of a pivot query that calls the **default** runner with a `qp.pivot/run-pivot-query`. The problem is that pulse needs to use a non-default runner, but there's no way for `process-query-for-card` to do both.
      
      This commit changes `run` to `make-run` which raises the abstraction to
      a function that produces a runer given a `qp`. This allows
      `process-query-for-card` to change the `qp` as needed while keeping the
      passed in runner.
      
      There's really three things going on that could be teased apart
      further/better.
      
      1. `qp` - this conflates the processor (`qp/process-query` `qp.pivot/run-pivot-query`)
        and modifying query (`qp/userland-query`,
        `qp/userland-query-with-default-constraints` `(update query :info merge info)`)
      2. `make-run` - How the above are processed: (streaming/realized)
      
      * Fix tests
      Unverified
      ea9dfd1d
  10. Jun 14, 2024
    • John Swanson's avatar
      Fix collection id on collection items endpoint (#44236) · 27e1ff64
      John Swanson authored
      * Fix a potential bug in `hydrate-can-restore`
      
      I had a bug here. I wanted to hydrate `:collection` on the items and
      then return the original items, but instead I was `dissoc`ing
      `:collection` from the items. If the original items passed in already
      had `:collection` keys this would break them.
      
      AFAIK this didn't cause any issues, but it could have - so fixing it here.
      
      * Add a test
      
      * Present collection items in the collection
      
      When fetching collection items, we need to fetch the true
      `collection_id` in order to figure out things like `can_restore` and
      `can_delete`, but set it to the displayed/effective `collection_id` when
      we actually send it out.
      
      This fixes a bug where collections had their `collection_id` match their
      `id` when returned by this endpoint.
      Unverified
      27e1ff64
    • John Swanson's avatar
      Always provide `can_restore` (#44124) · e677eb7a
      John Swanson authored
      Previously we were just adding this when the item was archived. Instead,
      always send a value - if the item is not archived, it can't be restored,
      so it will be `false` in this case.
      
      Making this change will make fixing a frontend bug easier, because the
      frontend will be able to just trust the `can_restore` value coming in
      from the backend.
      Unverified
      e677eb7a
  11. Jun 13, 2024
  12. Jun 12, 2024
    • dpsutton's avatar
      Handle errors when inferring separator of csv (#44073) · 8824bd9a
      dpsutton authored
      * Handle errors when inferring separator of csv
      
      This file
      
      ```
      "c1","c2"
      "a,b,c","d"
      ```
      
      was failing to upload for a silly reason: when we were checking for
      which separator it used, we had a parse error when using a semi-colon
      and that blew up the whole pipeline.
      
      * Use cal's helpful test suggestions
      Unverified
      8824bd9a
Loading