Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

DORA Dashboard SQL Bug — Double-Quoted String Literals

Status: Upstream bug in apache/incubator-devlake v1.0.3-beta12 / v1.0.4-alpha. Affects all DORA panels in the official dashboard JSON exports.

Discovered: 2026-06-10, after fixing the DevLake datasource in Grafana.

Severity: Low (cosmetic). DORA dashboards never render — every panel shows the error message instead of numbers. No data loss; numbers are correct in the underlying database.


Symptom

When the DORA datasource is correctly configured (database = lake, password valid), the dashboards still fail with:

db query error: Error 1054 (42S22): Unknown column 'N/A. Please check if you have collected deployments.' in 'field list'

This error appears in the affected panels:

DashboardPanel IDTitle
dfo090rqoyl8ge (DORA)8Overall DORA Metrics
dfo090rqoyl8ge (DORA)11Deployment Frequency
dfo090rqoyl8ge (DORA)12Median Lead Time for Changes In Hours
dfo090rqoyl8ge (DORA)14Change Failure Rate
dfo090rqoyl8ge (DORA)17Failed Deployment Recovery Time

The DORA (by Team) and the DORA Details dashboards have similar bugs in their SQL.

Root cause

The panel SQL has CASE / ELSE branches that return string literals using MySQL double-quote syntax:

ELSE "N/A. Please check if you have collected deployments." END

In MySQL, double-quoted identifiers are column names, not string literals. So MySQL’s parser tries to resolve "N/A. Please check if you have collected deployments." as a column name, doesn’t find it, and fails at parse time (not runtime — so the WHEN conditions never get a chance to match).

The correct MySQL syntax would be:

ELSE 'N/A. Please check if you have collected deployments.' END

(single-quoted string literal).

The bug is widespread in the dashboard SQL. The full grep returns ~14 occurrences across the DORA dashboard family:

$ grep -n '"N/A' /tmp/dora_panel11.sql
127:    ELSE "N/A. Please check if you have collected deployments." END
134:    ELSE "N/A. Please check if you have collected deployments." END
$ grep -n '"N/A' /tmp/dora_overall.sql
264: ELSE "N/A. Please check if you have collected deployments."
272: ELSE "N/A. Please check if you have collected deployments."
327: ELSE "N/A. Please check if you have collected deployments/pull_requests."
334: ELSE "N/A. Please check if you have collected deployments/pull_requests."
409: WHEN is_collected = "No All" THEN "N/A. Please check if you have collected deployments/incidents."
411: WHEN is_collected = "No Deployments" THEN "N/A. Please check if you have collected deployments."
416: ELSE "N/A. Please check if you have collected deployments/incidents."
419: WHEN is_collected = "No All" THEN "N/A. Please check if you have collected deployments/incidents."
421: WHEN is_collected = "No Deployments" THEN "N/A. Please check if you have collected deployments."
426: ELSE "N/A. Please check if you have collected deployments/incidents."
481: "Failed deployment recovery time" as metric,
488: ELSE "N/A. Please check if you have collected deployments or incidents."

Workaround (local fix in Grafana)

Until upstream fixes the bug, the workaround is to patch the dashboard JSON in Grafana. We can’t directly PUT the dashboard via API without an Editor-role token, so the fix has to be applied through the UI:

  1. In Grafana, open the affected dashboard → Settings (gear icon, top right) → JSON model
  2. Search for the patterns below and replace:
    • ELSE "N/A.ELSE 'N/A.
    • WHEN is_collected = "NoWHEN is_collected = 'No
    • WHEN count(deployment_id) is null then "No All"WHEN count(deployment_id) is null then 'No All'
  3. Save the dashboard
  4. Refresh the page — the panels should now show real numbers

For an automated fix via API (when you have an Editor token), the JSON dump + sed works:

# Export dashboard JSON
curl -H "Authorization: Bearer $TOKEN" \
  https://public-grafana-hh-production.f.aivencloud.com/api/dashboards/uid/dfo090rqoyl8ge > /tmp/dora.json

# Patch the SQL inside the targets
python3 -c "
import json
d = json.load(open('/tmp/dora.json'))
def patch(s):
    # The fix: replace the unquoted literal with a properly-quoted one
    return s.replace('ELSE \"N/A.', \"ELSE 'N/A.\") \
            .replace('WHEN is_collected = \"No', \"WHEN is_collected = 'No\") \
            .replace('when count(deployment_id) is null then \"No All\"', \"when count(deployment_id) is null then 'No All'\")
for p in d['dashboard'].get('panels', []):
    for t in p.get('targets', []):
        if t.get('rawSql'):
            t['rawSql'] = patch(t['rawSql'])
json.dump(d, open('/tmp/dora_patched.json', 'w'), indent=2)
"
# Re-upload via Grafana UI (paste the patched JSON)

Permanent fix (upstream)

A PR to apache/incubator-devlake should:

  1. Fix all ELSE "N/A. ..." patterns in the DORA dashboard JSON exports to use single quotes
  2. Add a smoke test in CI that imports the dashboards into a test Grafana and asserts they render (not just that the datasource is OK)
  3. The dashboards should ship with a graphTooltip of “See DevLake docs if data is missing” so users know the dashboards are working as designed