From ea19d84a4d69eb2dca61c09a496c08f0dca6c267 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Mon, 8 Jan 2018 22:03:37 -0800 Subject: [PATCH] Don't use fully qualified column names in metric definitions (#4101) When generating an auto SUM() metric on a column, Superset currently will go `SUM(table_name.column_name)`. This is an issue when moving to point to another table. It's common to work on some temporary table or work table and eventually need to point Superset to an alternate table. --- superset/connectors/sqla/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py index 889aea3ba9a1e..8ac6e8289a342 100644 --- a/superset/connectors/sqla/models.py +++ b/superset/connectors/sqla/models.py @@ -706,7 +706,7 @@ def fetch_metadata(self): if not any_date_col and dbcol.is_time: any_date_col = col.name - quoted = str(col.compile(dialect=db_dialect)) + quoted = col.name if dbcol.sum: metrics.append(M( metric_name='sum__' + dbcol.column_name,