From 3e5cd960a7053ccd39ffa346b5f013bc165fcaf9 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Wed, 20 Dec 2017 17:24:10 -0800 Subject: [PATCH] Don't use fully qualified column names in metric definitions 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 18803c565b76f..af0f96d3d40e9 100644 --- a/superset/connectors/sqla/models.py +++ b/superset/connectors/sqla/models.py @@ -660,7 +660,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,