Skip to content

View families

Two families write views, and they were one family until they were split apart. They share a root named view and mean different things by it, which is the whole reason the split happened: a designer view carries a stored SELECT and a structured model, while a derived history view projects a window function over a base table and has no stored SELECT to read at all. Handing the second shape the first one’s contract meant handing it fields there was nothing honest to fill.

Templates: databricks/shared/create_view.jinja, databricks/data_mart/source_view.jinja, fabric/shared/create_view.jinja, snowflake/shared/create_view.jinja

Roots: view

The frozen SELECT contract, and one root is the whole of it. A table without a stored view definition gets a typed refusal rather than a hollow render.

The root carries both halves of the contract: the identity and frozen statement a simple body needs, and a structured model a body can compose its own layout from. hasStructuredSelect is the switch between them. When it is false there is no model to walk and the template emits selectSql verbatim.

FieldTypeMeaning
view.schemastringThe schema the view is created in.
view.namestringThe view’s name as authored.
view.nameSnakeCasestringThe name through the snake-case naming model (what the mart source view materializes as).
view.selectSqlstringThe frozen SELECT statement with macro tokens resolved.
view.qualifiedNamestringThe reference the CREATE OR REPLACE VIEW names, already quoted and already in the calling dialect’s form: a plain schema and name pair, a catalog-qualified literal for the deploy bootstrap, or the exec_sql concatenation form for the notebook.
view.hasStructuredSelectbooleanWhether select, from and joins carry a model to compose from. False for a frozen SELECT, where the body emits selectSql as is.
view.isParameterisedbooleanWhether to emit the notebook parameter cell and wrap the statement in SET VARIABLE exec_sql plus EXECUTE IMMEDIATE. Branch on this, never on whether parameters.declarations is empty: an empty array is truthy in the template language.
view.parametersobjectThe notebook parameter cell.
view.select[]arrayThe projected column model, when the select is structured.
view.selectAllbooleanTrue when the view projects no columns and the select list is *.
view.fromobject?The base relation model; null when there is none.
view.joins[]arrayThe join model.
view.where[]string[]The filter predicates.
view.whereCountnumberHow many predicates there are. Branch on this rather than on the array, for the same truthiness reason as isParameterised.

Templates: databricks/shared/current_view.jinja, databricks/shared/effectivity_view.jinja

Roots: view, columns, base, partition_keys, effective_from, effective_to, default_end_date

The managed current and effectivity views over a history table. Here view is identity only, {schema, name} and nothing more, and the projection arrives as six flat roots beside it. The root names are flat and snake-cased because this shape predates the loading vocabulary.

FieldTypeMeaning
view.schema / view.namestringIdentity only: the schema and name the view is created as. There is no selectSql on this family.
base.schema / base.namestringThe base history table (persistent staging or a satellite) the view projects over.
columnsstring[]The base table’s column names, in base order (the projection list).
partition_keysstring[]Window partition keys. Resolution order: the resolved parent hub or link hash key (satellite bases), then table-level business-key columns, then column-flagged business keys, then primary keys. An empty result makes the Build skip the view with a warning.
effective_fromstringThe load-date column the window orders by, from the naming profile.
effective_tostringThe computed effective-to column’s alias. A constant, and its value is dv_row_load_edts rather than the root’s own name.
default_end_datestringThe open-ended row’s end date, from the naming profile, defaulting to 9999-12-31.