Skip to content
Snippets Groups Projects
  • dpsutton's avatar
    1ebae228
    Substitute persisted queries in parameter card references (#25610) · 1ebae228
    dpsutton authored
    * 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
    Substitute persisted queries in parameter card references (#25610)
    dpsutton authored
    * 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
Code owners
Assign users and groups as approvers for specific file changes. Learn more.