{% if _dataset %}{{ _dataset }}.{% endif %}{{ row.dbt_model_name or _table }}{% endset %}
{% call header_card(_title) %}
{% if row.dbt_model_name %}
dbt
{% endif %}
{% if row.author_email %}
{{ row.author_email }}
{% endif %}
{% endcall %}
{# Six-card stat strip - aggregated lifetime metrics on the left
half, last-execution snapshot on the right half. Lives outside
the ``ui-surface`` header so the cards read as a standalone strip
(mirrors the dashboard's cost-summary row). ``grid-cols-6`` isn't
in the pre-compiled Tailwind bundle (same constraint as
``_cost_summary.html``), so we inline the 6-column rule below
the xl breakpoint and rely on Tailwind's built-in 1/2/3 cols at
smaller widths. #}
{% from "components/_stat_card.html" import stat_card %}
{%- set _exec_meta = ("across " ~ row.execution_count ~ " executions") if (row.execution_count and row.execution_count > 1) else None -%}
{{ issue.row.explanation }}
{% if issue.rule_meta and issue.rule_meta.description %}{{ issue.rule_meta.description }}
{% endif %}{{ issue.template_result.explanation }}
{% if issue.diff_lines %}SQL diff in Available improvements below.
{% endif %} {% elif improvements %} {# Audit has SQL-rewrite improvements queued for this table. List them by display name so the user sees what's available without scrolling. SQL rewrites are deterministic byte-for- byte changes but MAY NOT fully resolve every issue type - slot contention, for example, often needs scheduling changes or slot reservation alongside any rewrite. #}Available rewrites queued in Available improvements below:
These rewrites reduce work touched by the query and may help, but won't always fully resolve {{ issue.row.opportunity_type | replace('_', ' ') }} on their own - the underlying fix is often at the schema (partition / cluster) or scheduling layer.
{% if layout_chip_targets %}For partition / cluster recommendations on this table (typically higher-confidence for scan-volume issues), see the chips above.
{% endif %} {% else %}No single-query SQL rewrite is available for this issue type. The fix is typically at the workload-scheduling, slot-reservation, or schema layer.
{% if layout_chip_targets %}Partition / cluster recommendations are available - see the chips above.
{% endif %} {% endif %}{{ imp.explanation }}
{% endif %} {% if imp.diff_lines or imp.before_content %}No diff available - template did not produce a change.
{% endif %}{{ imp.rollback }}
{% for line in job.query.split('\n') %}{{ loop.index }}{{ line }}
{% endfor %}