We would like to make use of the extend / inheritance features of Looker as much as we could. I need to figure out if there is a best practice to show only particular fields from the inherited view. Let me explain with an example (which is actually a real life use case I’m working on now)
Imagine an order view file like the following with 10s of dimensions defined:
- view: order {
dimension: customer_id
dimension: merchant_id
dimension: order_id
dimension: latest_order
...
}
(I’m excluding the definitions as they are not relevant to the discussion)
Then we have another view that extends this and overwrite the definition of customer_id and order_id:
- view: new_order {
extends: [order]
dimension: customer_id
dimension: order_id
}
So my goal is to display only customer_id, order_id and latest_date in the final look that is based on new_order. We don’t need to (or want to) display the 10s of dimensions inherited from ‘order’ view (just to keep the All Fields view on explore to the minimum set of required fields for this particular report)
Finally, the model file that I couldn’t validate:
include: "*.view"
- explore: new_order {
fields: [new_order.customer_id, new_order.order_id, `'new_order.latest_order'`]
}
Looker complains of missing reference for latest_order. I try using the original view namespace, table name, $ substitution to refer to latest_order but the error stays.
Of course, I could just declare latest_order field in new_order view with the same definition in order view. But I believe that defeats the purpose of inheritance, no?
Your suggestions are appreciated. I’m still learning Looker so perhaps I’m overlooking a scope definition somewhere.