Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Mar 15, 2023
  2. Mar 14, 2023
  3. Mar 13, 2023
  4. Mar 10, 2023
  5. Mar 04, 2023
  6. Mar 03, 2023
  7. Mar 02, 2023
  8. Mar 01, 2023
    • metabase-bot[bot]'s avatar
      Add /api/logs/query_execution endpoint for downloading logs. (#28560) (#28821) · d0a60e39
      metabase-bot[bot] authored
      
      * Add /api/logs/query_execution endpoint for downloading logs.
      
      Intended for admins to use only via api to manually save logs if they want. Paired with auto-deleting the
      query_execution after N days (30 by default), this should help admins keep the query_execution table light.
      
      * Add docstrings
      
      * Add a test for the logs/query_execution endpoint
      
      This test checks that the correct rows are returned, that is, those within the specified number of days.
      
      * Tests should pass with h2 now.
      
      * Move logs endpoint to Enterprise, allowed only with `:advanced-config`
      
      * Forgot to remove api.logs ns require from OSS routes
      
      * Wrap logs endpoint in proper premium feature
      
      * Test will filter further to only look for THIS run's temp rows
      
      * Alter query to give results for a month specified as YYYY-MM
      
      This lets admins do paginated log downloads, which is good if the query_execution table is quite large (very likely,
      at least initially).
      
      * Add sanity check test. Address other review feedback
      
      Co-authored-by: default avataradam-james <21064735+adam-james-v@users.noreply.github.com>
      Unverified
      d0a60e39
    • metabase-bot[bot]'s avatar
  9. Feb 28, 2023
    • dpsutton's avatar
      Delay substituting persisted native query until after analysis (#28739) · c4050fee
      dpsutton authored
      * Delay substituting persisted native query until after analysis
      
      We were substituting persisted queries into the query at too early a
      stage.
      
      Card 729 is a persisted model of `select * from categories`
      
      ```clojure
      {:type :query,
       :query {:source-table "card__729",
               :expressions {:adjective ["case"
                                         [[[">" ["field" 100 nil] 30]
                                           "expensive"]
                                          [[">" ["field" 100 nil] 20]
                                           "not too bad"]]
                                         {:default "its ok"}]},
               :aggregation [["count"]],
               :breakout [["expression" "adjective" nil]
                          ["field" 101 nil]]},
       :database 3,
       :parameters []}
      ```
      
      This would immediately get turned into an equivalent
      
      ```clojure
      {:type :query,
       :query {:source-table 12
               :persisted-info/native "select \"id\", \"ean\", \"title\", \"category\", \"vendor\", \"price\", \"rating\", \"created_at\" from \"metabase_cache_424a9_3\".\"model_729_products_r\""
               :expressions {:adjective ["case"
                                         [[[">" ["field" 100 nil] 30]
                                           "expensive"]
                                          [[">" ["field" 100 nil] 20]
                                           "not too bad"]]
                                         {:default "its ok"}]},
               :aggregation [["count"]],
               :breakout [["expression" "adjective" nil]
                          ["field" 101 nil]]},
       :database 3,
       :parameters []}
      ```
      
      And the obvious failure here is the use of `[:field 100 nil]` (price)
      against an inner query of `select ... price ... from cache_table`. This
      could break many queries and caused a flood of
      
      ```
      WARN middleware.fix-bad-references :: Bad :field clause [:field 100 #:metabase.query-processor.util.add-alias-info{:source-table :metabase.query-processor.util.add-alias-info/source, :source-alias "price"}] for field "products.price" at [:expressions "adjective" :case :>]: clause should have a :join-alias. Unable to infer an appropriate join. Query may not work as expected.
      WARN middleware.fix-bad-references :: Bad :field clause [:field 100 #:metabase.query-processor.util.add-alias-info{:source-table :metabase.query-processor.util.add-alias-info/source, :source-alias "price"}] for field "products.price" at [:expressions "adjective" :case :>]: clause should have a :join-alias. Unable to infer an appropriate join. Query may not work as expected.
      ```
      
      * forgot to commit new test file
      
      * Handle persisted before native
      
      * Add test for native models
      
      - have to populate the metadata. You can do this by running the query,
      but there are some requirements around the `:info` object to actually
      save it. So just take the more mechanical route
      - `wait-for-result` returns a time out value, but it's namespaced
      autoresolved to a namespace inside of the metabase.test forest and not
      mt itself. So easy to mess up and watch for the wrong keyword. Want an
      arity so i can check my own timeout value and throw a helpful error
      message. I checked around and noone seems to care. So not great, but at
      least people aren't checking `::mt/timed-out` when it should be
      `::tu.async/timed-out` or
      `:metabase.test.util.async/timed-out`. Possibly best scenario is we
      remove the autoresolved bit and have it return `:async/timed-out` or
      something stable.
      
      * properly compile the native query
      
      * bump timeout to set redshift metadata
      Unverified
      c4050fee
    • john-metabase's avatar
      Serdes v2 clean up collections option handling (#28745) · 0761928a
      john-metabase authored
      Cleans/fixes serdes v2 export :collections handling in cmd and API
      Unverified
      0761928a
    • john-metabase's avatar
    • Ngoc Khuat's avatar
      Add tests for sandbox user apis (#28601) · ee44d788
      Ngoc Khuat authored
      * add tests for sandbox user apis
      Unverified
      ee44d788
    • Ngoc Khuat's avatar
      add tests for 2 permissions api (#28675) · d774262b
      Ngoc Khuat authored
      Unverified
      d774262b
  10. Feb 27, 2023
  11. Feb 24, 2023
  12. Feb 23, 2023
  13. Feb 22, 2023
  14. Feb 20, 2023
    • Case Nelson's avatar
      Convert H2 driver to honey-sql-2 (#28273) · f827b28e
      Case Nelson authored
      
      * Fix linter
      
      * Make sure we're inlining num in substitution and sum aggregations
      
      * Set hsql version
      
      * Fixing tests
      
      * Fixing tests after the h2 conversion
      
      * Use h2x/extract in h2, fix test differences
      
      * Fixing tests for honeysql2
      
      * Only numbers get inlined
      
      * More test fixes
      
      * Fixing tests
      
      * Undo bad commit
      
      * Inline Ratio must produce doubles or h2 will do integer division where 1/2 = 0
      
      * Fix bad case statement
      
      * We can't run native queries with AS for oracle
      
      ---------
      
      Co-authored-by: default avatarCam Saul <github@camsaul.com>
      Co-authored-by: default avatarCam Saul <1455846+camsaul@users.noreply.github.com>
      Unverified
      f827b28e
    • Cal Herries's avatar
      Fix serdes for query actions missing database dependency (#28449) · 83bf928b
      Cal Herries authored
      * Fix action loading and extraction of action type
      
      * Remove comment
      Unverified
      83bf928b
    • Ryan Laurie's avatar
      Metabase Entity Link Dashboard Cards (#28248) · d591f34a
      Ryan Laurie authored
      
      * add dashcard testing mocks
      
      * improve virtual card overlays
      
      * update types
      
      * add search entity types
      
      * add metabase entity support to link cards
      
      * simplify link displays
      
      * update types and support collections and tables
      
      * use edit button to replace entity
      
      * test entity links
      
      * fix rebase
      
      * update types
      
      * address review comments
      
      * handle restricted link entities
      
      * Hydrate link cards info (#28297)
      
      * hydrate link cards info
      
      * we need to hydrate collections too
      
      * Address Cal's comments:
      - model use keywrod -> string
      - use model hydration
      - comments here and there
      
      * Link cards serdes (#28321)
      
      ---------
      
      Co-authored-by: default avatarNgoc Khuat <qn.khuat@gmail.com>
      Unverified
      d591f34a
  15. Feb 17, 2023
  16. Feb 14, 2023
    • Aleksandr Lesnenko's avatar
    • Cal Herries's avatar
      [Feature] Allow actions to be shared via public link: Milestone 2 (#27845) · ce64e033
      Cal Herries authored
      
      * Add public_uuid and made_public_by_id to actions table & endpoints to enable/disable the public sharing on individual actions (#27721)
      
      * Add migration for public_uuid (indexed) and made_public_by_id
      
      * Add UUIDString schema
      
      * Add endpoints for enabling/disabling sharing of actions
      
      * Test that the new fields are returned with `GET /api/action/:id`
      
      * Remove validCheckSum on migration
      
      * Remove trailing whitespace
      
      * Fix DELETE test
      
      * Fix tests
      
      * Please migration linter
      
      * Update the default public_uuid every test run
      
      * Please migration linter
      
      * Add FK onDelete cascade
      
      * Replace ü
      
      * Add GET endpoint and post-select for action
      
      * Revert "Add GET endpoint and post-select for action"
      
      This reverts commit 8cc8b57d6034146dd726b54bc4199830ec1fda21.
      
      * Fix merge
      
      * Reorder migrations
      
      * Update test for GET `api/action?model-id=<id>` endpoint to include public sharing keys (#27802)
      
      * Add GET: /api/public/action/:uuid endpoint (#27781)
      
      * Add test
      
      * Remove non-public columns and check for 404
      
      * Fix docstring
      
      * Rename for clarity
      
      * Fix missing ns
      
      * Remove unneccessary keys from action
      
      * Update test
      
      * Remove unused refer
      
      * Reorder migrations
      
      * Use mt
      
      * Add require and refactor
      
      * Use mt
      
      * Add endpoint for executing a public action (#27793)
      
      * Add endpoint and test
      
      * Add more tests and TODOs
      
      * Use mt
      
      * Reorder migrations
      
      * Remove unused require
      
      * Rate limit actions at 1 per second
      
      * Fix the tests for the throttle
      
      * Refactor tests
      
      * Fix test
      
      * Fix docstring
      
      * Add test for failed execution if actions are disabled
      
      * Use crowberto in tests
      
      * Fix using crowberto in tests
      
      * Fix cyclic load dependency
      
      * Add GET api/action/public endpoint
      
      * Use defendpoint
      
      * Add action-api-test
      
      * Add model_id to GET action/public response
      
      * Update GET api/action/public test for model_id
      
      * Add actions to public sharing admin settings (#27675)
      
      * Add actions to public sharing admin settings
      
      * Add public action in public sharing admin settings tests
      
      ---------
      
      Co-authored-by: default avatarMahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
      Unverified
      ce64e033
    • Tim Macdonald's avatar
      Ensure actions are created with models (not cards) (#28299) · 54a56bab
      Tim Macdonald authored
      [Fixes #28298]
      Unverified
      54a56bab
  17. Feb 10, 2023
  18. Feb 09, 2023
  19. Feb 08, 2023
  20. Feb 07, 2023
    • Braden Shepherdson's avatar
      Standardize on `metabase.util.log` for logging; use it everywhere (#28050) · dad3d414
      Braden Shepherdson authored
      This has the same interface as `clojure.tools.logging` but supports CLJS
      as well. It was formerly known as `metabase.shared.util.log`.
      Unverified
      dad3d414
    • Ngoc Khuat's avatar
    • Cal Herries's avatar
      Serdes for Actions (#27879) · 115d42c6
      Cal Herries authored
      * Whitespace
      
      * Add Action to entities list
      
      * Add entity_id column migration
      
      * Correct migration ids
      
      * Add entity-id property to action model
      
      * Extract and serdes-dependencies for action
      
      * storage for Action
      
      * ingest for Action
      
      * Generate for Action
      
      * load for Action
      
      * Remove comment
      
      * Add entity_id to action submodels
      
      * Add submodels to copy entities
      
      * Add submodels to exported-models
      
      * Add submodels to legal-top-level-paths
      
      * Slufigy extracted label for action
      
      * Extract for QueryAction
      
      * Generate query_action
      
      * Fix query_action extract test
      
      * Add action subtype extract tests
      
      * Update Action-subtype-IModel-impl docstring
      
      * Generate ImplicitAction and HTTPAction
      
      * Export and Import action_id FK with dashcards
      
      * Generate nano-id
      
      * Add load tests to e2e test
      
      * Nest subtypes directories in actions
      
      * Remove prn
      
      * Add docstring
      
      * Fix copy
      
      * Add select-action fn
      
      * Change extract tests to only extract Action model
      
      * Update action/select-one tests
      
      * Update legal-top-level-paths
      
      * Rename select-action -> select-one
      
      * Implement extract-one for Action only, not subtypes
      
      * Move subtype models from exported to inlined
      
      * Remove entity_id from subtypes
      
      * Reuse type->model
      
      * Ingest Action with inlined subtype info
      
      * Fix serdes-dependencies for Action
      
      * Add action to serdes-descendants for Dashboard
      
      * Add docstring to action update!
      
      * Reuse update! for PUT API
      
      * Add missing ns
      
      * Remove serdes-generate-path impl
      
      * Tidy
      
      * Sort ns
      
      * Restore add-entity-id
      
      * Update entity_id_test
      
      * Undo refactor
      
      * Include id in action arg for update!
      
      * Delete action, with delete cascading to the subtype
      
      * Fix clj-kondo warning
      
      * Fix returning nil Action in dashboard serdes-descendants
      
      * Braden's suggestions
      Unverified
      115d42c6
Loading