Skip to content

Conversation

@jni-bot
Copy link
Contributor

@jni-bot jni-bot commented Jan 30, 2026

Summary

Skip calling _get_default_value() for keys that aren't Pydantic fields in _get_domain_kwargs(), _get_success_kwargs(), and _get_runtime_kwargs().

Problem

During checkpoint validation, GX logs a noisy INFO message repeatedly:

_get_default_value called with key "table", but it is not a known field

For a simple 5-expectation suite, this message fires 6 times for a single ExpectColumnToExist expectation - the only expectation with "table" in its domain_keys.

The root cause: _get_domain_kwargs() iterates over all domain_keys and calls _get_default_value() for each key not in configuration.kwargs. For keys like "table" that are valid domain keys but not Pydantic fields, _get_default_value() logs the message and returns None.

Solution

Add an inline conditional to only call _get_default_value() when the key is actually a Pydantic field:

key: self.configuration.kwargs.get(
    key, self._get_default_value(key) if key in self.__fields__ else None
)

This preserves the existing behavior (returning None for non-field keys) while avoiding the unnecessary log message.

Additionally, adds a _get_success_kwarg(key, default=None) single-key accessor method for callers that only need one or two specific values, avoiding the overhead of building the full merged dictionary.

Changes

  • great_expectations/expectations/expectation.py:

    • Add inline conditional in _get_domain_kwargs(), _get_success_kwargs(), _get_runtime_kwargs()
    • Add _get_success_kwarg() method
    • Update ColumnMapExpectation._validate(), ColumnPairMapExpectation._validate(), MulticolumnMapExpectation._validate() to use _get_success_kwarg()
  • great_expectations/expectations/core/expect_column_to_exist.py:

    • Update _validate() to use _get_success_kwarg()
  • tests/expectations/test_expectation.py:

    • Add TestGetSuccessKwarg class with parametrized tests
    • Add TestKwargsMethodsNoLoggingForNonFields class to verify no logging for non-field keys

Test Plan

  • All existing tests pass (99 in test_expectation.py)
  • New unit tests for _get_success_kwarg() (9 parametrized tests)
  • New tests verifying no logging for non-field keys (3 parametrized tests)
  • PostgreSQL integration tests pass (4976 passed)
  • Manual validation: log noise reduced from 6 to 0 messages per checkpoint run

…eld keys

Skip calling _get_default_value() for keys that aren't Pydantic fields in
_get_domain_kwargs(), _get_success_kwargs(), and _get_runtime_kwargs().

Previously, these methods would call _get_default_value() for every key in
their respective key lists, which logged an INFO message for keys like
"table" that are valid domain keys but not Pydantic fields. This caused
noisy logs during normal expectation validation.

Changes:
- Add inline conditional to only call _get_default_value() when key is in
  __fields__, otherwise return None directly
- Add _get_success_kwarg() single-key accessor method for callers that only
  need one or two specific values
- Update ExpectColumnToExist._validate() to use _get_success_kwarg()
- Update ColumnMapExpectation, ColumnPairMapExpectation, and
  MulticolumnMapExpectation _validate() methods to use _get_success_kwarg()
- Add unit tests for new method and no-logging behavior
@netlify
Copy link

netlify bot commented Jan 30, 2026

👷 Deploy request for niobium-lead-7998 pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit cc39f99

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants