{# Spec 154 v3 - materialization section rendered on the opportunity
detail page.
Fires when one or more of this table's opportunities carries a
materialization payload - either an audit-detected candidate
(``materialization_candidate``, possibly with any of the four
strategies below) or Google's MV Recommender pass-through
(``bq_materialization_recommendation``).
The audit-detected card branches on ``recommended_strategy``:
* ``materialized_view`` - full MV card with generated SQL tabs
and the stat strip (cost / executions / avg bytes).
* ``ephemeral`` - inline-as-CTE card with the dbt node id
+ the downstream models that would absorb the inline.
* ``table`` - persist-as-table card with build vs.
read counts.
* ``incremental`` - switch-to-incremental card with the
representative build SQL so the user can see the filter the
fitter matched.
Inputs from the route:
``audit_mv_candidates`` - list of evidence_snapshot dicts (one
per audit-detected opportunity on this table); each carries
a ``recommended_strategy`` field.
``bq_mv_recommendations`` - list of dicts (BQ Recommender rows)
each with: target_resource, target_table_full_name,
bq_description, bq_recommendation_state, bq_insights[],
last_refresh_time
Renders nothing when both lists are empty, so the partial can be
included unconditionally from detail.html. #}
{% macro strategy_pill(strategy) %}
{%- if strategy == "ephemeral" -%}
ephemeral
{%- elif strategy == "incremental" -%}
incremental
{%- elif strategy == "table" -%}
table
{%- elif strategy == "materialized_view" -%}
materialized view
{%- else -%}
{{ strategy or "unspecified" }}
{%- endif -%}
{% endmacro %}
{% macro candidate_summary(strategy, source_label, object_label=None, state=None) %}
{{ object_label }}
Evidence
{{ reasoning.observation }}
Action
{{ reasoning.recommendation }}
Impact
{{ reasoning.expected_benefit }}
Check
{{ caveats[0] }} {% if caveats | length > 1 %} +{{ caveats | length - 1 }} more {% endif %}
Consumers
{{ cand | tojson(indent=2) }}
{{ rec.bq_description }}
{% endif %} {% if rec.bq_insights %}Insights
Last refreshed by Google's Recommender: {{ rec.last_refresh_time }}
{% endif %}