Substitute persisted queries in parameter card references (#25610)
* Substitute persisted queries in parameter card references ```sql select o.total, o.quantity, model_p.category, model_p.title from orders o left join {{#14-pg-products}} model_p -- reference to products model on o.product_id = model_p.id limit 4 ``` Testing: I'm unhappy with how verbose the test is. At some point we're going to need a better, standardized way to test persistence. But the test makes a persisted table of the test-data.categories table (test/metabase/test/data/dataset_definitions/test-data.edn). It runs some sql to update the values in the table to turn `"Winery"` -> `"Winery from cached table"`, joins the two tables together to have both at once. There's a lot of moving pieces and the setup is a bit verbose. There's also no obvious place where these types of tests should go. We'll need to consolidate them in the future (and extend them). * persisted macro * docstring for `persisted-info-native-query` * alignments and small nits * Reuse persistence macro * clj-kondo cleanups * remove clj-kondo change before rebase
Showing
- .clj-kondo/config.edn 1 addition, 0 deletions.clj-kondo/config.edn
- .clj-kondo/macros/metabase/test/persistence.clj 5 additions, 0 deletions.clj-kondo/macros/metabase/test/persistence.clj
- enterprise/backend/test/metabase_enterprise/sandbox/query_processor/middleware/row_level_restrictions_test.clj 2 additions, 9 deletions...uery_processor/middleware/row_level_restrictions_test.clj
- src/metabase/driver/common/parameters/values.clj 11 additions, 4 deletionssrc/metabase/driver/common/parameters/values.clj
- src/metabase/query_processor/middleware/fetch_source_query.clj 9 additions, 48 deletions...etabase/query_processor/middleware/fetch_source_query.clj
- src/metabase/query_processor/util/persisted_cache.clj 51 additions, 0 deletionssrc/metabase/query_processor/util/persisted_cache.clj
- test/metabase/driver/common/parameters/values_test.clj 59 additions, 2 deletionstest/metabase/driver/common/parameters/values_test.clj
- test/metabase/task/persist_refresh_test.clj 11 additions, 17 deletionstest/metabase/task/persist_refresh_test.clj
- test/metabase/test.clj 5 additions, 0 deletionstest/metabase/test.clj
- test/metabase/test/persistence.clj 32 additions, 0 deletionstest/metabase/test/persistence.clj
Loading
Please register or sign in to comment