{% from "opportunities/_materialization.html" import reasoning_block, strategy_pill %} {% macro materialization_side_content(audit_mv_candidates=None, bq_mv_recommendations=None) %} {% set _audit = audit_mv_candidates or [] %} {% set _bq = bq_mv_recommendations or [] %} {% if _audit or _bq %}
{% for cand in _audit %} {% set _strategy = cand.recommended_strategy or "materialized_view" %}
{{ strategy_pill(_strategy) }} audit-detected
{% if cand.dbt_node_id or cand.suggested_mv_name %}

{{ cand.dbt_node_id or cand.suggested_mv_name }}

{% endif %}
{{ reasoning_block(cand.reasoning, caveats=(cand.safety_caveats or cand.caveats)) }} {% if cand.downstream_dbt_node_ids %}

Consumers

{% for downstream in cand.downstream_dbt_node_ids[:3] %} {{ downstream }} {% endfor %} {% if cand.downstream_dbt_node_ids | length > 3 %} +{{ cand.downstream_dbt_node_ids | length - 3 }} more {% endif %}
{% endif %}
{% endfor %} {% for rec in _bq %}
{{ strategy_pill("materialized_view") }} BigQuery Recommender {% if rec.bq_recommendation_state %} {{ rec.bq_recommendation_state }} {% endif %}
{% if rec.target_table_full_name or rec.target_resource %}

{{ rec.target_table_full_name or rec.target_resource }}

{% endif %}
{% if rec.bq_description %}

{{ rec.bq_description }}

{% endif %} {% if rec.bq_insights %}

Insights

    {% for ins in rec.bq_insights[:2] %}
  • {{ ins.description }}
  • {% endfor %} {% if rec.bq_insights | length > 2 %}
  • +{{ rec.bq_insights | length - 2 }} more insights
  • {% endif %}
{% endif %}
{% endfor %}
{% else %}

No materialization suggestion is attached here.

{% endif %} {% endmacro %}