Skip to content

[MAINTENANCE] Add SQL result_format regression coverage for expect_column_values_to_be_unique#11964

Open
joshua-stauffer wants to merge 7 commits into
developfrom
m/unique-result-format-regression-guards
Open

[MAINTENANCE] Add SQL result_format regression coverage for expect_column_values_to_be_unique#11964
joshua-stauffer wants to merge 7 commits into
developfrom
m/unique-result-format-regression-guards

Conversation

@joshua-stauffer

Copy link
Copy Markdown
Collaborator

Summary

Adds regression coverage for ExpectColumnValuesToBeUnique result_format behaviors on SQL backends (PostgreSQL, SQLite). These behaviors depend on internals of the column_values.unique metric that are easy to break when its SQL implementation changes, and were previously untested:

  • COMPLETE + unexpected_index_column_names composed with a row_condition — the test data is constructed so a value is duplicated only when the filtered-out row is included, proving the condition is applied and the index list hydrates correctly.
  • include_unexpected_rows composed with a row_condition.
  • unexpected_index_query must be executable against the source database and return exactly the unexpected rows (the query string is surfaced to users in validation results and Data Docs).
  • exclude_unexpected_values=True must return the columnar {index_column: [values, ...]} index-list shape shared by all SQL map expectations.
  • Importing great_expectations must not emit metric re-registration warnings on stderr.

Changes

  • tests/integration/data_sources_and_expectations/expectations/test_expect_column_values_to_be_unique.py: five new tests plus a dedicated dataset and a small helper that fails loudly if any metric raised instead of producing a value.

Testing

  • SQLite parameterizations and the unit-marked import test run and pass locally against develop.
  • Ruff check and format (pinned pre-commit version) are clean.

…_be_unique

Pin down behaviors of the column_values.unique metric on SQL backends that
are easy to break when its implementation changes:

- COMPLETE + unexpected_index_column_names composed with a row_condition
- include_unexpected_rows composed with a row_condition
- unexpected_index_query must execute against the source database and
  return exactly the unexpected rows
- exclude_unexpected_values must return the columnar index-list shape
  shared by all SQL map expectations
- importing great_expectations must not emit metric re-registration
  warnings on stderr
@netlify

netlify Bot commented Jul 10, 2026

Copy link
Copy Markdown

Deploy Preview for niobium-lead-7998 canceled.

Name Link
🔨 Latest commit 2b064d1
🔍 Latest deploy log https://app.netlify.com/projects/niobium-lead-7998/deploys/6a51682e0eb8e000080de377

@joshua-stauffer joshua-stauffer marked this pull request as ready for review July 10, 2026 09:23
- Narrow batch.datasource to SQLDatasource before calling get_engine()
  (mypy attr-defined)
- Allow 30s for the subprocess import test; the default unit timeout of
  2s is too tight for a full library import
The ignore on the NotImported fallback assignment is only needed when
pyarrow is installed (mypy then types the name as Module). In
environments without pyarrow the module resolves as Any, and
--warn-unused-ignores fails the build. Adding unused-ignore makes the
ignore valid in both environments.
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