From 7ecd62922399dbd7173b8def35e3283075dec3e0 Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Mon, 7 Oct 2024 10:26:46 +0300 Subject: [PATCH] Fix: metrics wasn't handling non ORM join correctly --- redash/metrics/database.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redash/metrics/database.py b/redash/metrics/database.py index 152427b2e5..6f16bdbc6d 100644 --- a/redash/metrics/database.py +++ b/redash/metrics/database.py @@ -5,7 +5,7 @@ from sqlalchemy.engine import Engine from sqlalchemy.event import listens_for from sqlalchemy.orm.util import _ORMJoin -from sqlalchemy.sql.selectable import Alias +from sqlalchemy.sql.selectable import Alias, Join from redash import statsd_client @@ -18,7 +18,7 @@ def _table_name_from_select_element(elt): if isinstance(t, Alias): t = t.original.froms[0] - while isinstance(t, _ORMJoin): + while isinstance(t, _ORMJoin) or isinstance(t, Join): t = t.left return t.name