Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Aug 19, 2024
  2. Jul 16, 2024
  3. Apr 19, 2024
  4. Apr 17, 2024
  5. Mar 08, 2024
    • Cam Saul's avatar
      Convert QP to MLv2 (Part 1) (#39613) · 2dccd287
      Cam Saul authored
      * Keep fetch_source_query.clj
      
      * Copy fetch_source_query.clj into fetch_source_query_legacy.clj
      
      * Set back fetch_source_query.clj file
      
      * Convert QP to MLv2, part 1
      
      * Keep legacy implementation around for time being
      
      * Port thru convert-to-legacy
      
      * expand-macros is converted to legacy
      
      * Test fixes :wrench:
      
      * Test fixes and better keys
      
      * Test fixes
      
      * Test fixes :wrench:
      
      * More test fixes :wrench:
      
      * Test fix? :wrench:
      
      * Wow, maybe I finally fixed everything :wrench:
      
      * Last few test fixes :wrench:
      
      * PR feedback; lib.walk should support splicing in multiple replacement stages
      
      * Update fetch-source-query to use improved lib.walk
      
      * Have I fixed everything now? :wrench:
      
      * Remove stray println
      
      * Another MongoDB fix :wrench:
      
      * Remove the changes to expand-macros for now, we can do that in a follow-on PR.
      
      * Test fix
      
      * Test fix
      Unverified
      2dccd287
  6. Mar 07, 2024
  7. Feb 15, 2024
    • Cam Saul's avatar
      Mega QP context and entrypoint overhaul. Reduce QP hairiness by 30% (#35465) · 80dcbdfb
      Cam Saul authored
      * QP enterprise middleware should use `defenterprise`
      
      * Test fix? :wrench:
      
      * Remove `:rff` from the Query Processor context map
      
      * Sort namespaces
      
      * Simplify QP entrypoints part 1
      
      * Test fixes :wrench:
      
      * Test fixes :wrench:
      
      * Make sure defenterprise dispatch is done for every QP run
      
      * B I G  QP context overhaul
      
      * WIP
      
      * Remove qp.context.default
      
      * Test fix :wrench:
      
      * PR feedback
      
      * QP context overhaul [WIP] [ci skip]
      
      * QP context overhaul [WIP] [ci skip]
      
      * Fix duplicate preprocesses
      
      * Some test fixes.
      
      * More test fixes [ci skip]
      
      * Source card resolution middleware should be preprocessing middleware, not around [ci skip]
      
      * Test fixes [WIP] [ci skip]
      
      * Remove `test-qp-middleware`
      
      * Remove `qp/compile`
      
      * Fix Kondo warnings/cleanup
      
      * Remove `mt/compile`
      
      * Fix most tests
      
      * Mostly everything working?
      
      * 4 failures, 1 error
      
      * Eliminate QP context `reducedf`
      
      * 3 failures, 0 errors <3
      
      * All tests are passing <3
      
      * Remove dead debug-qp code
      
      * Fix test failure
      
      * Remove async context
      
      * Remove raisef
      
      * Forget it, just remove context entirely [ci skip]
      
      * Fix Kondo errors
      
      * Fix Kondo warnings
      
      * Fix Kondo warnings
      
      * Fix Kondo warnings
      
      * Remove empty namespace
      
      * Fix some reflection warnings
      
      * Update dox [ci skip]
      
      * Test fix :wrench:
      
      * Fix pivot QP
      
      * Misc improvements
      
      * Test fix :wrench:
      
      * Improvements and test fixes
      
      * More test fixes :wrench:
      
      * Test fixes :wrench:
      
      * Address PR feedback
      
      * Test fixes :wrench:
      
      * More test fixes and docstring improvements
      
      * Appease Eastwood
      
      * Test fixes :wrench:
      
      * More test fixes
      
      * Test fixes :wrench:
      
      
      
      * Revert test parallelization in metabase.models.params.chain-filter-test
      
      * Update src/metabase/async/util.clj
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      
      ---------
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      Unverified
      80dcbdfb
  8. Nov 17, 2023
  9. Aug 24, 2023
  10. Aug 03, 2023
  11. Feb 07, 2023
  12. Jan 30, 2023
  13. Dec 29, 2022
  14. Sep 29, 2022
  15. Jul 15, 2022
    • dpsutton's avatar
      Async card metadata (#23672) · 21aa0053
      dpsutton authored
      
      * Lets use the main thread
      
      * Strip out channel stuff and rename
      
      * 202 -> 200 response
      
      When returning a channel we return a 202. A map is just a 200. Since we
      no longer need to have the main stuff async (as opposed to the metadata
      stuff) we can just return the map with a 200 instead of this long
      running channel stuff and a 202.
      
      * Last test
      
      * renames, logging, ensure query is the same before saving metadata
      
      * Sandbox test 202 -> 200
      
      * Another 202 -> 200
      
      * Put timeout on async metadata saving
      
      timeout of 15 minutes before we give up on the async metadata saving. It
      is possible this cuts things off but hard to tell if work is still being
      done at that point.
      
      * outdated comment
      
      * Return json error message, not text/plain
      
      this is a subtle one that I'm not happy about. Our error handling will
      return text/plain if you throw an `(ex-info "something" {:status-code
      400})`.
      
      ```shell
      ❯ http post localhost:3000/api/timeline-event/ name=some-name description=Bob timestamp=2022 timezone=America/Central time_matters:=false timeline_id:=1629  Cookie:$COOKIE
      HTTP/1.1 404 Not Found
      Content-Type: text/plain
      
      Timeline with id 1,629 not found
      ```
      
      But if you add extra information to the map to the ex-info, you get
      json!
      
      ```clojure
      (defmethod api-exception-response Throwable
        [^Throwable e]
        (let [{:keys [status-code], :as info} (ex-data e)
              other-info                      (dissoc info :status-code :schema :type)
              body                            (cond
                                                (and status-code (empty? other-info))
                                                ;; If status code was specified but other data wasn't, it's something like a
                                                ;; 404. Return message as the (plain-text) body.
                                                (.getMessage e)
      
                                                ;; if the response includes `:errors`, (e.g., it's something like a generic
                                                ;; parameter validation exception), just return the `other-info` from the
                                                ;; ex-data.
                                                (and status-code (:errors other-info))
                                                other-info
      
                                                ;; Otherwise return the full `Throwable->map` representation with Stacktrace
                                                ;; and ex-data
                                                :else
                                                (merge
                                                 (Throwable->map e)
                                                 {:message (.getMessage e)}
                                                 other-info))]
          {:status  (or status-code 500)
           :headers (mw.security/security-headers)
           :body    body}))
      ```
      
      So this fix is a _very_ subtle way to get to what we want, although it
      does add a bunch of extra junk to our response.
      
      ```javascript
      {
       ...
       "message": "Invalid Field Filter: Field 26 \"PRODUCTS\".\"CATEGORY\"
      belongs to Database 1 \"Sample Database\", but the query is against
      Database 990 \"copy of sample dataset\"",
       "data": {
         "status-code": 400,
         "query-database": 990,
         "field-filter-database": 1}
       ...
      }
      ```
      
      Reminder of what we want: the frontend is saving a card. We added a
      field filter on a database and then changed the source database of the
      query. So the backend needs to reject the field filter as being on the
      wrong db. The FE expects a json response with a message and will then
      show that message in the save/edit modal.
      
      Why did this come up now: these endpoints for saving and editing a card
      used to always return 202 streaming responses. This means they would
      have to tuck any errors inside of an already open 202 response. Which is
      why you get a message as a json response. But now that they are sync,
      the api can just return a proper 400 with a reason. But we still want
      that to be a json response for the FE.
      
      * error layout fix
      
      * Several Cleanups
      
      - make sure numbers have units at the end (-ms)
      - use (u/minutes->ms 15) rather than a more opaque (* 15 60 1000)
      - move the scheduled metadata saving into its own function
      
      This last bit is actually a bit more than that. I was previously
      throwing everything in a thread submitted to the pooled executor. I'm
      now using a `future` but with a caveat: All of the waiting for the
      timeout, checking if we got metadata is done in a simple `a/go` block
      now, and the thread does just the last bit of IO. We have to select the
      card as it is now to ensure the query is the same and then save.
      
      Refresher on why we have to check if the query is the same. We have up
      to 15 minutes to wait for the query metadata to come back. Completely
      possible for them to have edited the query and then our metadata is
      useless.
      
      Co-authored-by: default avatarAleksandr Lesnenko <alxnddr@gmail.com>
      Unverified
      21aa0053
  16. Apr 19, 2022
    • Braden Shepherdson's avatar
      Make namespace aliasing consistent everywhere; enforce with clj-kondo (#21738) · 19beda53
      Braden Shepherdson authored
      * Make namespace aliasing consistent everywhere; enforce with clj-kondo
      
      See the table of aliases in .clj-kondo/config.edn
      
      Notable patterns:
      - `[metabase.api.foo :as api.foo]`
      - `[metabase.models.foo :as foo]`
      - `[metabase.query-processor.foo :as qp.foo]`
      - `[metabase.server.middleware.foo :as mw.foo]`
      - `[metabase.util.foo :as u.foo]`
      - `[clj-http.client :as http]` and `[metabase.http-client :as client]`
      
      Fixes #19930.
      Unverified
      19beda53
  17. Aug 25, 2021
    • Cam Saul's avatar
      Block permissions backend (#17428) · bf2ba1f3
      Cam Saul authored
      * :no_entry: B L O C K :warning: permissions :white_check_mark:
      
      * Fix test failure in OSS since EE namespace doesn't exist.
      
      * Remove unused var
      
      * Oops, uncomment a commented-out test
      
      * Clean up the new perms documentation a bit
      Unverified
      bf2ba1f3
  18. Jun 23, 2021
  19. Jan 07, 2021
  20. Oct 23, 2020
Loading