View the original community article here
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.