Skip to content

Add cross-dataset referential integrity checks#294

Merged
JE-Chen merged 1 commit into
devfrom
feat/referential-batch
Jun 21, 2026
Merged

Add cross-dataset referential integrity checks#294
JE-Chen merged 1 commit into
devfrom
feat/referential-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 21, 2026

Copy link
Copy Markdown
Member

What

Adds dbt-style referential checks validate_rows couldn't do (it is intra-row, single-table; its unique only dedupes within one batch).

  • check_foreign_key(child_rows, child_col, parent_rows, parent_col){ok, violations, missing}.
  • check_unique_key(rows, cols) — single or composite key → {ok, duplicates}.
  • check_accepted_values(rows, col, allowed){ok, violations, unexpected}.
  • check_row_count(rows, minimum=, maximum=){ok, count}.

Operates on rows from load_rows / query_sqlite.

Layers

  • Headless core: utils/referential/ (pure stdlib collections, zero PySide6).
  • Facade: 4 symbols + __all__.
  • Executor: AC_check_foreign_key, AC_check_unique_key, AC_check_accepted_values, AC_check_row_count.
  • MCP: ac_check_* (read-only).
  • Script Builder: all four under Data.
  • Tests: test/unit_test/headless/test_referential_batch.py (8 tests, no Qt).
  • Docs: v86_features_doc.rst (EN + Zh) + toctrees + 3 README What's-new sections.

Verification

  • pytest test/unit_test/headless/test_referential_batch.py → 8 passed.
  • ruff check je_auto_control/ clean; pylint 10.00/10; bandit clean; radon CC clean.
  • Package stays Qt-free.

validate_rows is intra-row and single-table — its unique rule only dedupes
within one batch. Add dbt-style generic checks: check_foreign_key
(parent/child across two tables), check_unique_key (single/composite),
check_accepted_values, and check_row_count, operating on rows already
loaded by load_rows/query_sqlite. Wired through facade, executor (four
AC_check_* commands), MCP, and the Script Builder with a headless test
batch and EN/Zh docs.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 47 complexity · 0 duplication

Metric Results
Complexity 47
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit ce24ba1 into dev Jun 21, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/referential-batch branch June 21, 2026 17:52
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant