Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Nov 15, 2024
  2. Nov 14, 2024
    • Noah Moss's avatar
    • dpsutton's avatar
      sync the attached datawarehouse (#49970) · 113d75ce
      dpsutton authored
      * sync the attached datawarehouse
      
      requires either "sync_db" true or a table name
      
      it will error
      ```shell
      ❯ http post 'localhost:3000/api/notify/db/attached_datawarehouse' x-metabase-apikey:apikey -pb
      Must provide `sync_db` or a `table_name` to sync
      ```
      
      It will sync the db when sync_db is true [NOTE: this is outdated. now just omitting the table name will sync the db]
      ```shell
      ❯ echo '{"synchronous?": true, "sync_db": true}' | http post 'localhost:3000/api/notify/db/attached_datawarehouse' x-metabase-apikey:apikey -pb
      {
          "success": true
      }
      ```
      
      It will sync existing tables
      ```shell
      ❯ http post 'localhost:3000/api/notify/db/attached_datawarehouse' table_name=existing schema_name=public x-metabase-apikey:apikey -pb
      {
          "success": true
      }
      ```
      
      it will error if it cannot find a table
      ```shell
      ❯ http post 'localhost:3000/api/notify/db/attached_datawarehouse' table_name=new schema_name=public x-metabase-apikey:apikey -pb
      {
          "cause": "Unable to identify table 'public.new'",
          "data": {
              "schema_name": "public",
              "status-code": 404,
              "table_name": "new"
          },
          "message": "Unable to identify table 'public.new'",
          "schema_name": "public",
          "table_name": "new",
          "trace": [],
          "via": [
              {
                  "data": {
                      "schema_name": "public",
                      "status-code": 404,
                      "table_name": "new"
                  },
                  "message": "Unable to identify table 'public.new'",
                  "type": "clojure.lang.ExceptionInfo"
              }
          ]
      }
      ```
      
      if i create that table
      ```sql
      attached=# create table new (id int);
      CREATE TABLE
      ```
      
      it will then find and sync it
      
      ```shell
      ❯ http post 'localhost:3000/api/notify/db/attached_datawarehouse' table_name=new schema_name=public x-metabase-apikey:apikey -pb
      {
          "success": true
      }
      ```
      
      * formatting
      
      * Tests for attached datawarehouse
      
      * PR nits
      
      typo in `thorw` -> `throw`
      comment explaining why `find-and-sync-new-table` is always sync
      gensym the db name in test
      remove a binding for a fn `sync!` that's only called once
      test `{:sync_db true}` syncs the whole db
      
      * stupid formatting :mechanical_arm:
      
      * Use absence of table_name as indicator to sync database
      Unverified
      113d75ce
    • Chris Truter's avatar
    • Chris Truter's avatar
    • Chris Truter's avatar
  3. Nov 13, 2024
  4. Nov 12, 2024
  5. Nov 11, 2024
  6. Nov 10, 2024
  7. Nov 08, 2024
  8. Nov 07, 2024
  9. Nov 06, 2024
    • adam-james's avatar
      Filter out Empty Rows from Pivot Exports (#49512) · 63151f4e
      adam-james authored
      * Pivot Measures Order Used in Pivot Exports
      
      Fixes #48442
      
      A pivot table can have any number of measures, and the user can order these by dragging in the UI. Before this PR,
      that order was ignored and measures would alway be in index order, which is confusing for any user who needs the
      measures to be displayed in a particular order, especially if they've re-ordered them in the pivot viz settings UI.
      
      A test has been added to check that measure order is used.
      
      A few minor changes to the pivot qp and post-processor
       - measure indices are looked up in the pivot qp and added in viz-settings order
       - the pivot measures are only added if the qp has not already added them.
       - pivot-opts Malli spec has been made in the namespace, adjusted to allow `nil` as a valid pivot-opts output, and
       used in relevant functions
      
      * address review points.
      
      * add a rows order test
      
      * Filter out Empty Rows from Pivot Exports
      
      Fixes #49353
      
      The linked issue is not actually related to pivot export size but is instead related to the 'Min of Created At: Month'
      aggregation; the default aggregation function was `+`, so it broke when the date string was encountered.
      
      That was fixed.
      
      As I was trynig to keep the export small if possible, I noticed that in some cases empty rows are appended, so I added
      the filter so that if a pivot row's values are completely empty, it doesn't add it.
      
      Finally, this PR also adds the 'sub section totals' which I noticed were missing from the exports. This comes up when
      you have 3+ pivot-rows configured, so you can see the subtotals for the first pivot row and the subtotals nested
      within those sections for the second pivot row, and so on.
      
      * add test for non-numeric values
      
      * Make sure the new name refs match on aggregations not just breakouts
      
      * cljfmt
      Unverified
      63151f4e
    • Noah Moss's avatar
    • Alexander Polyankin's avatar
      Fix :pivot-measures with column names (#49575) · 240634d3
      Alexander Polyankin authored
      
      * Fix :pivot-measures with column names
      
      * Fix the test
      
      * Update src/metabase/query_processor/pivot.clj
      
      Co-authored-by: default avatarBraden Shepherdson <braden@metabase.com>
      
      * Add a test
      
      * Add a test
      
      ---------
      
      Co-authored-by: default avatarBraden Shepherdson <braden@metabase.com>
      Unverified
      240634d3
    • Braden Shepherdson's avatar
      [testing] Add filters to random query generators (#49448) · 46191072
      Braden Shepherdson authored
      Adds filters to generative testing for queries.
      
      There's a lot of new code here, but don't panic, it's quite straightforward:
      generating filter values, in the right shapes for various filter expressions.
      Unverified
      46191072
Loading