Last tested; Mar 11, 2021
Yes! Even though usually, extends
will only replace parameters that have the same name definition, sql_table_name
and derived_table
are special, since they're mutually exclusive. They cannot both be used at once in a single view file. Therefore they follow standard extends logic as if they were the same parameter, and the losing view's table parameter is ignored.
Example: When using an explore with view_a
, my_fancy_table
is used in the generated SQL. When using an explore with view_b
, the derived table with my_favorite_table
is used in the generated SQL.
view: view_a {
sql_table_name: my_cool_schema.my_fancy_table ;;
...
}
view: view_b {
extends: [view_a]
derived_table: {
sql: SELECT * FROM my_cool_schema.my_favorite_table ;;
}
...
}
This content is subject to limited support.
Thanks for this post. It is great.
Will you please explain how view_b works?
It extends the view_a and it has own derived_table. I do not understand how the view_b works.
for example, when defining new measures and dimensions from its own derived table, when define new measure using the information from view_a etc.
I am confused the view_b is basing on two sources, one is view_a and one is own derived table.
How do they interact each other? Will u please use a more real example? thanks
view: view_b {
extends: [view_a]
derived_table: {
sql: SELECT * FROM my_cool_schema.my_favorite_table ;;
}