{% set traces = record.queries | selectattr("stack_trace") | list %} {% if traces %}
Tracebacks
{% for q in traces %}
#{{ loop.index }} {{ q.sql[:80] }}{% if q.sql|length > 80 %}…{% endif %} {{ "%.2f"|format(q.duration_ms) }} ms
{{ q.stack_trace }}
{% endfor %}
{% else %}
No stack traces available. Enable capture_query_stacktrace=True in Config to capture them.
{% endif %}