In Great Expectations (v1.15.*), I’m using expect_query_results_to_match_comparison to compare two SQL query result sets. Even when I set per-expectation result_format to COMPLETE and include options like:
-
include_unexpected_rows: true
-
return_unexpected_index_query: true
-
unexpected_index_column_names: [...]
the validation result still only contains aggregate metrics such as unexpected_count and unexpected_percent, and does not include any row-level payload fields like unexpected_rows, unexpected_index_list, or unexpected_index_query (they are missing/null in the returned result).
Is this expected behavior for expect_query_results_to_match_comparison (i.e., it only returns summary mismatch metrics), or should those row-level fields be populated when using COMPLETE with the options above?
Hi @Keerthiraj thanks for the question. The problem is here:
Even when I set per-expectation result_format to COMPLETE
In GX v1+ result_format is set on the Checkpoint, or passed as a runtime value to ValidationResult.run(…) or Checkpoint.run(…). It cannot be set on the Expectation. See our docs on result_format for more information.
Hope that helps - if you are still encountering issues with the documented API, please share a standalone code snippet that reproduces the error and I’ll take a look!
1 Like
Thank you for your valuable response. When I run expect_query_results_to_match_comparison locally in VS Code after setting up the environment, it works as expected. However, when I execute it in the Databricks notebook, the Data Docs are not being generated only the folder structure is created.
Could you also clarify whether there is an option to generate test results for the expected records as well (i.e., the passed scenarios)?
Multi-assert tests: I am using expect_query_results_to_match_comparison and I am performing the source and target for count, structure, and data. I also need to store the result documentation for both passed and failed records. Please share if any samples available.
is there an option to generate test results for the expected records as well
ValidationResults and data docs have test results for both passing and failing expectations.
However, when I execute it in the Databricks notebook, the Data Docs are not being generated only the folder structure is created.
sounds like a separate issue, i’d recommend opening a separate thread specific to that question. Please share a standalone code snippet that reproduces the error.