From 4de6fae26e6bcdae100107ae12b3388079f425c0 Mon Sep 17 00:00:00 2001 From: Teddy Date: Mon, 20 May 2024 19:52:21 +0200 Subject: [PATCH] Minor: None query res check on table metrics (#16334) * fix: None query res check on table metrics * style: ran python linting --- .../profiler/orm/functions/table_metric_computer.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ingestion/src/metadata/profiler/orm/functions/table_metric_computer.py b/ingestion/src/metadata/profiler/orm/functions/table_metric_computer.py index 10de8698a31..30df9b03c17 100644 --- a/ingestion/src/metadata/profiler/orm/functions/table_metric_computer.py +++ b/ingestion/src/metadata/profiler/orm/functions/table_metric_computer.py @@ -231,6 +231,8 @@ class OracleTableMetricComputer(BaseTableMetricComputer): ) res = self.runner._session.execute(query).first() + if not res: + return None if res.rowCount is None or ( res.rowCount == 0 and self._entity.tableType == TableType.View ): @@ -260,6 +262,8 @@ class ClickHouseTableMetricComputer(BaseTableMetricComputer): ) res = self.runner._session.execute(query).first() + if not res: + return None if res.rowCount is None or ( res.rowCount == 0 and self._entity.tableType == TableType.View ): @@ -306,6 +310,8 @@ class BigQueryTableMetricComputer(BaseTableMetricComputer): ) res = self.runner._session.execute(query).first() + if not res: + return None if res.rowCount is None or ( res.rowCount == 0 and self._entity.tableType == TableType.View ): @@ -337,6 +343,8 @@ class BigQueryTableMetricComputer(BaseTableMetricComputer): where_clause, ) res = self.runner._session.execute(query).first() + if not res: + return None if res.rowCount is None or ( res.rowCount == 0 and self._entity.tableType == TableType.View ): @@ -366,6 +374,8 @@ class MySQLTableMetricComputer(BaseTableMetricComputer): ) res = self.runner._session.execute(query).first() + if not res: + return None if res.rowCount is None or ( res.rowCount == 0 and self._entity.tableType == TableType.View ): @@ -400,6 +410,8 @@ class RedshiftTableMetricComputer(BaseTableMetricComputer): columns, self._build_table("svv_table_info", "pg_catalog"), where_clause ) res = self.runner._session.execute(query).first() + if not res: + return None if res.rowCount is None or ( res.rowCount == 0 and self._entity.tableType == TableType.View ):