Hello, good people.
Let me present to you the following use case.
Let's suppose we have a model file, test_model which has one explore test_explore.
Now I use a refinement of this explore with a predefined query quick_query
explore: test_explore {
...
}
+test_explore{
query: quick_query {
dimensions: ...
measures: ...
filters: [...]
}
}
Next, I need to either refine or extend test_explore into a different model, test_model_2
+test_explore{
...
}
When I do that, the quick_query would carry over to the new model. Which I do not want. What I need is a parameter inside the refinement/extend that would allow me to hide quick_query , something like
show_query: no
Please do not propose me to create a copy of the original explore without quick_query and then apply the refinement to the new model. That is a cumbersome and non-OOP way of doing things.
Solved! Go to Solution.
Hey @Annoyed_dev !
This happens as the parameter query inside of an explore, whenever it's extended or refined, it's additive. So everytime it will appear in every new extend of this explore.
Currently this parameter (show_Query: no) doesn't exist but there is a workaround (that I hope it can work for you).
The idea is to have a base explore that is going to be used in several places and in some places will be with X quick queries and in other without them.
One workaround that i've used is to have a base explore coming from the view called order_items where I don't have the quick query included. This explore has the extension: required option to be used as base explore that is going to be used as extension. This explore itself it won't exist on the Explore menu.
Then I create an explore that extends this first explore and include there the quick queries that i want.
And the next explore will extend the base explore but you can see without any quick queries.
That's a way to reuse the code and not repeat stuff.
Please share if this works!!
Here you have the code explanation:
explore: base_order_items {
from: order_items
extension: required
}
explore: order_items {
extends: [base_order_items]
view_name: order_items
query: total_orders {
dimensions: [
created_date
]
measures: [total_orders]
}
materialization: {
sql_trigger_value: last_day(current_date,month) ;;
}
}
explore: new_explore {
extends: [base_order_items]
view_name: order_items
}