OpenParable
Skip to content
← Back to skills

Referential Integrity Check

Testing & Quality
referential_integrity_check

Referential Integrity Check is an Agent Skill for testing & quality published in the cas-bigdatalab/piflow repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

引用完整性校验工具。读取子表及参考表,检查外键值是否存在于参考键集合中,标记孤立记录行并输出结果文件。 当用户提到外键检查、引用完整性、孤立记录、父子表引用等需求时使用此skill。 即使用户没有明确说出“引用完整性”,只要任务涉及检查字段值是否能在参考表中找到,就应该使用此skill。 不负责重复行、空值、列存在性、字段格式等其他校验任务。

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/cas-bigdatalab/piflow/blob/HEAD/workspace/skills/referential_integrity_check/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/referential-integrity-check, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Referential Integrity Check 引用完整性校验 Skill

功能概述

外键约束检查。两类模式:(1) 同表引用 — check_field 的值必须在同表的 reference_column 中存在;(2) 跨表引用 — check_field 的值必须在外部 reference_path 文件的 reference_column 中存在。标记在参考集中找不到匹配值的孤立行。

触发条件

当用户提到以下任务时,应使用此 skill:

  • 外键检查
  • 引用完整性
  • 孤立记录
  • 父子表引用

使用方法

python scripts/referential_integrity_check.py --input_path <输入文件> --output_path <输出文件> --check_field <检查字段> --reference_path <参考表文件> --reference_column <参考列> --qc_mark <质控标识> --mark_field_name <标识字段名>

核心参数说明

必需参数

参数说明
--input_path输入文件路径
--output_path输出文件路径
--check_field检查字段(外键)
--reference_column参考列(主键)
--qc_mark质控标识

可选参数

参数说明默认值
--reference_path外部参考表(不指定则同表)同表
--mark_field_name质控标识字段名QC0000

注意事项

  1. 空值不标记为孤立值(仅标记有值但不在参考集中的行)
  2. 参考值取自 reference_column 的去重集合
  3. 列不存在时直接报错退出