From 6719404d981768fb2af1458738c7e1c95363025d Mon Sep 17 00:00:00 2001 From: Farmer Date: Fri, 20 Sep 2024 16:05:34 -0600 Subject: [PATCH] Protext against any return type --- .../expectations/metrics/query_metrics/query_table.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/great_expectations/expectations/metrics/query_metrics/query_table.py b/great_expectations/expectations/metrics/query_metrics/query_table.py index f734154148e5..efe258b8f964 100644 --- a/great_expectations/expectations/metrics/query_metrics/query_table.py +++ b/great_expectations/expectations/metrics/query_metrics/query_table.py @@ -77,7 +77,12 @@ def _sqlalchemy( result: Union[Sequence[sa.Row[Any]], Any] = execution_engine.execute_query( sa.select(sa.text(query)) ).fetchmany(MAX_IN_MEMORY_RECORDS_ALLOWED) - return [element._asdict() for element in result] + + if isinstance(result, (list, tuple)): + query_table_records = [element._asdict() for element in result] + else: + query_table_records = [result] + return query_table_records # @metric_value(engine=SparkDFExecutionEngine)