{{ job.destination_short }}{% endset %}
{% else %}
{% set _title %}{{ job.job_id }}{% endset %}
{% endif %}
{% call header_card(_title) %}
{% if job.workload_kind == "build" %}
{{ signal_chip("Build", color="brand", title="Build - this query writes a destination table") }}
{% elif job.workload_kind == "consumption" %}
{{ signal_chip("Consumption", color="teal", title="Consumption - read-only query, no destination written") }}
{% endif %}
{% if job.is_dbt_originated or job.origin_tool == "dbt" %}
dbt
{% endif %}
{% if job.user_email and job.user_email != "-" %}
{% set _author_label %}{{ job.user_email }}{% endset %}
{{ signal_chip(_author_label, color="slate") }}
{% endif %}
{% if job.origin_tool and job.origin_tool != "ad_hoc" and not (job.origin_tool == "dbt" and job.is_dbt_originated) %}
{% set _origin_label %}{{ job.origin_tool | replace('_', ' ') }}{% endset %}
{{ signal_chip(_origin_label, color="slate") }}
{% endif %}
{{ job.job_id }}
{{ job.statement_type }}
{% if job.cache_hit %}
{{ signal_chip("Cache hit", color="slate") }}
{% endif %}
{% endcall %}
{%- set _scan_cost = cohort_aggregates.cost_usd if cohort_aggregates else job.cost_usd -%}
{%- set _runs = cohort_aggregates.execution_count if (cohort_aggregates and cohort_aggregates.execution_count) else 1 -%}
{{ issue_count }} issue{{ '' if issue_count == 1 else 's' }} · {{ suggestion_count }} suggestion{{ '' if suggestion_count == 1 else 's' }} · {{ _scan_cost | format_usd }} in the scan window
{# Same four-column stat grammar as opportunity detail. The primary values are aggregated across the destination table when a cohort exists; the muted line shows the latest execution snapshot. #} {%- set _last_ts = latest_execution.creation_time.strftime("%Y-%m-%d %H:%M UTC") if (latest_execution and latest_execution.creation_time) else "" -%} {%- set _agg_bytes = cohort_aggregates.bytes_processed if cohort_aggregates else job.bytes_processed -%} {%- set _agg_slot_ms = cohort_aggregates.slot_time_ms if cohort_aggregates else job.slot_time_ms -%} {%- set _cost_meta = ( "last " ~ (latest_execution.cost_usd | format_usd) ~ ((" / " ~ _last_ts) if _last_ts else "") ) if latest_execution else None -%} {%- set _bytes_meta = ( "last " ~ (latest_execution.bytes_processed | format_bytes) ~ ((" / billed " ~ (latest_execution.bytes_billed | format_bytes)) if latest_execution.bytes_billed is not none else "") ) if (latest_execution and latest_execution.bytes_processed is not none) else None -%} {%- set _slot_meta = ( ("last " ~ (latest_execution.duration_ms | format_duration) ~ " wall") if (latest_execution and latest_execution.duration_ms is not none) else None ) -%}Cost
{{ _scan_cost | format_usd }}
{% if _cost_meta %}{% endif %}Bytes processed
{{ (_agg_bytes | format_bytes) if _agg_bytes is not none else "-" }}
{% if _bytes_meta %}{% endif %}Slot time
{{ ("%.1f" | format((_agg_slot_ms or 0) / 3600000) ~ " hrs") if _agg_slot_ms is not none else "-" }}
{% if _slot_meta %}{% endif %}Executions
{{ "{:,}".format(_runs) }}
{{ issue.explanation }}
{% endif %}{{ issue.rule_description }}
{% endif %} View opportunity{{ imp.explanation }}
{% endif %}