跳到正文
Skillpedia
数据库41k · #6855

debugging-failed-data-quality-checks

它能做什么

本技能说明数据检查为何显示为红色,展示导致该结果的行,并建议需要做哪些修改。适合维护数据仓库数据、需要处理失败检查的人。

适用场景

  • ✓当数据质量检查显示“失败”或“出错”,并且你想知道原因的时候。
  • ✓当你想查看某项检查所匹配的具体行时。
  • ✓当物化视图在刷新后显示“未发布”消息或数据过期的时候。

技能链接

https://github.com/PostHog/posthog/blob/master/products/data_quality/skills/debugging-failed-data-quality-checks/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/PostHog/posthog/blob/master/products/data_quality/skills/debugging-failed-data-quality-checks/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“为什么我的订单唯一性检查失败了?哪些行是重复的?”

每周 5 个新技能,1 分钟读完。

工作原理

它首先读取检查的状态,因为这能显示问题是出在数据本身、检查本身,还是某个无法运行的查询中。然后,它再查看匹配的行。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Debugging failed data quality checks

A check run ends in one of four states. Read the state first, because it decides where the problem is:

Status Meaning Where to look
failed The query ran and the assertion found bad data The data, or the assertion itself
errored The query could not run, so nothing was judged The error text (never a data problem)
skipped The subject is gone Whether the table or view still exists
passed The assertion held Nothing

row_count and freshness checks judge observed_value, not failed_row_count. A failed row_count means the count fell outside its bounds. A failed freshness means the newest row is older than the limit.

When to use this skill

  • A check or a subject shows failed or errored and the user wants to know why
  • The user wants to see the rows a check matched
  • A materialized view's latest run shows an error that starts with Not published:
  • A view kept serving old data after a refresh, and the data quality gate is on
  • Another skill (authoring-data-quality-checks or auditing-warehouse-view-health) found a failing check or a blocked view and handed it off

Available tools

Tool Purpose
posthog:data-quality-check-results A check's recent runs, with compiled_query, error and the config it ran
posthog:execute-sql Re-run a run's compiled_query to see the failing rows
posthog:data-quality-check-run Run a check now
posthog:data-quality-check-update Fix an assertion or change its severity
view-get A view's definition and status
view-run-history A view's materialization runs and their errors
view-run Materialize a view again

To find the failing checks, query system.information_schema.data_quality_checks for last_status IN ('failed', 'errored'), or system.information_schema.data_quality_health for a subject's verdict.

Workflow

Step 1: Read the run

Call posthog:data-quality-check-results for the check. On the newest run, read:

  • status and error
  • check_config and check_severity: what the run asserted, which can differ from the check today
  • compiled_query: HogQL that selects the failing rows. For row_count it returns the count instead, so judge that check by observed_value.
  • audited_staged_refresh: true when the run was part of a gated audit of a refresh before it was published. An errored run can carry it too, so read status first.

Retention clears compiled_query after 30 days. For an older run, run the check again.

Step 2: Look at the failing rows

Run compiled_query with posthog:execute-sql. An empty compiled_query means there is nothing to replay: retention cleared it, or a gated run could not read the view's definition. Look at what it matched before you report anything. A failure means one of two things: the data is bad, or the assertion is wrong. The rows tell you which.

When audited_staged_refresh is true, the query does not read the published table. It holds the view's definition in a WITH clause and reads the view's source tables now. The sources may have changed since the run, so the rows and the count can differ from the run. A query that now returns zero rows does not prove that the refresh was clean. Compare with failed_row_count on the run.

Step 3: Read an errored run

An errored run did not judge the data. Match the error text:

| Error text | Cause and fix | | ---

常见问题

“出错”是什么意思?

它表示检查查询无法运行,因此没有对数据做出判断。问题通常在错误信息中,而不在数据里。

为什么行数检查没有显示失败的行?

行数检查是将观察到的行数与其范围进行比较,因此你应查看该计数,而不是寻找匹配的行。

视图显示“未发布”是什么意思?

这表示刷新被阻止,因为数据质量关卡未通过,较新的数据没有被发布。

详情

作者的原始描述

Finds out why a data quality check failed or errored, looks at the rows it matched, and recommends the fix. Also covers a materialized view refresh that the data quality gate did not publish. Use when asked why a check is red, what rows failed, why a view shows "Not published", why a view's data is stale after a refresh, or how to get a blocked refresh published. Trigger terms: failed check, failing rows, errored check, data quality failure, not published, blocked materialization, unpublished refresh, check keeps failing.

repo: PostHog/posthog

热度

GitHub 星标
41k
排名
#6855
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能