Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Mar 01, 2023
  2. 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
  3. Feb 27, 2023
  4. Feb 24, 2023
  5. Feb 23, 2023
  6. Feb 22, 2023
  7. 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
  8. Feb 17, 2023
  9. 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
  10. Feb 10, 2023
  11. Feb 09, 2023
  12. Feb 08, 2023
  13. 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
  14. Feb 06, 2023
  15. Feb 03, 2023
    • metamben's avatar
      Invalidate sandbox FieldValues cache on question change (#27783) · d01d519b
      metamben authored
      * Invalidate sandbox FieldValues cache on question change
      
      See #25411 for context.
      
      * Increase precision of report_card.updated_at to a microsecond
      
      This is so that the test doesn't have to wait a second to get a modified timestamp.
      It's also more consistent with other timestamp columns.
      
      * Add back test cases for :linked-filter
      Unverified
      d01d519b
  16. Feb 02, 2023
    • Bryan Maass's avatar
      insert next-gen permission paths alongside currently active permission paths +... · c46337ad
      Bryan Maass authored
      insert next-gen permission paths alongside currently active permission paths + classification (#27911)
      
      * implement move, which returns v2 paths
      
      - TODO: insert these into the db
      
      (move v1-path) => [v2 paths]
      
      * cleanup + add some schemas
      
      * generative tests 4 permission path classification
      
      * whitespace lint
      
      * detect data, query, and paths for v2
      
      * calling move on v2 paths is a no-op
      
      * differentiate between v1 and v2 permissions
      
      quickchecking for move, classify-path, and classify-data-path
      
      * fix tests + add idempotency test
      
      * add tests for classification of permission paths
      
      - rename move to ->v2-path
      - move some fxns around
      - ascii art in test
      
      * making the legos line up
      
      - need to insert both v1 and v2 versions of paths (of course)
      - valid-path? has to allow v2 paths to be inserted
      
      * replace mu/with-api-error-message
      
      * linter + code quality fixes
      
      * privatize rx->kind
      
      * remove some changes that should be 4 anotherbranch
      
      * revert ns
      
      * delete v2 permissions in
      
      - they aren't handled by the perm graph parser, so they don't get propagated into "old graph", so the diff between old and new indicates that they need to be rewritten.
      
      * only delete v2 paths for the current group_id
      
      - reorder declarations in models.permissions
      
      * remove extra line break
      
      * Update src/metabase/models/permissions.clj
      
      fix typo
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      
      ---------
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      Unverified
      c46337ad
    • Mark Bastian's avatar
      Ban println/printf via clj-kondo config (#27997) · 021c6708
      Mark Bastian authored
      Added bans for print and friends. Fixed issues in kondo config where a macroexpansion put in a print by replacing with (constantly nil) as a no-op.
      Unverified
      021c6708
  17. Feb 01, 2023
Loading