Aidp Verified Queries

作者 oracle-samples90b42d6c24d4无许可证收录于 2026年10月8日更新于 2026年10月8日

Register and validate reusable question→Spark-SQL pairs in .aidp/verified-queries.md so the agent reuses trusted SQL before generating new SQL. Use when the user wants to save a working query as canonical, build a verified-query repository, or improve answer reliability for recurring questions. Validates each pair on the cluster before marking it verified.

AI 生成的概览

维护经过验证的问题到 Spark SQL 配对库,让智能体在生成新 SQL 前优先复用可信查询。

功能
维护按项目存放的问题到 Spark SQL 配对文件,在将候选查询标记为已验证之前先在集群上执行校验。它会记录逻辑名称与实际访问的表,按既定格式追加条目,并将校验失败的配对保留为草稿并说明原因。最终形成一个经过整理的查询库,供数据分析技能按问题相似度和表重叠进行匹配。
适用场景
适用于将可用查询保存为常见问题的标准答案、整理或清理已验证查询库,以及提升重复问题的回答可靠性。
运行要求
需要访问 Spark 集群,并提供区域、数据湖 OCID、工作区和集群键,以及用于签发 UPST 的 api_key DEFAULT 配置。校验通过随附的 SQL 辅助脚本执行;不要求 MCP 服务器,但可选使用 MCP 加速。

aidp-verified-queries — the verified-query repository (VQR)

Maintain .aidp/verified-queries.md: validated question → Spark SQL pairs that aidp-analyzing-data reuses before generating SQL from scratch — the highest-reliability NL-to-SQL mechanism.

When to use

  • Save a working query as the canonical answer to a recurring question.
  • Curate/clean the verified-query repository.

Quality gate (critical — do not skip)

A wrong verified query makes accuracy worse. Before setting verified: true, the pair MUST:

  1. be syntactically valid Spark SQL,
  2. execute on the cluster (run it via the bundled scripts/aidp_sql.py helper),
  3. actually answer the stated question (sanity-check the result shape/values). If any check fails, keep verified: false (DRAFT) and explain why — never auto-promote a failing pair.

Workflow

  1. Read the candidate question + SQL (or take the last query run in aidp-analyzing-data).
  2. Prefer logical names from .aidp/semantic.md; record the physical tables touched.
  3. Validate by running the SQL on the cluster with the bundled helper (no MCP required):
    bash
    python "$PLUGIN_DIR/scripts/aidp_sql.py" \  --region <region> --datalake <DATALAKE_OCID> --workspace <ws> --cluster <cluster-key> \  --code "spark.sql('''<your SELECT … LIMIT 50>''').show(50, truncate=False)"
    It mints a UPST from the api_key DEFAULT profile, auto-creates a scratch notebook, and returns JSON {status, outputs, spark_job_ids}. Require status == "ok" and a result that answers the question. Run on a bounded sample (add LIMIT) to keep validation cheap.
  4. Append the entry to .aidp/verified-queries.md in the documented format; set verified: true only on a recorded successful run (note cluster + date).
  5. On reuse, aidp-analyzing-data matches by question similarity + table overlap and adapts only dates/bind values.

Notes

  • .aidp/verified-queries.md is user-editable and git-ignored (per-project).
  • Keep entries small, single-purpose; complex asks get a complete worked example.
  • This skill is self-contained: validation runs through scripts/aidp_sql.py, not any MCP server. If an aidp MCP happens to be configured you may use its nb_execute_code as an accelerator, but it is not required.

References

  • references/verified-queries.md · references/semantic-model.md
  • SQL execution helper: references/no-mcp-rest-map.md (No-MCP SQL via scripts/aidp_sql.py)

来源与署名

来源:oracle-samples/oracle-aidp-samples位于ai/claude-code-plugins/oracle-ai-data-platform-workbench-engineer-agent/skills/aidp-verified-queries提交90b42d6

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架

更多来自 oracle-samples/oracle-aidp-samples 的技能