From c8f0cfc3181fe40ec0ca0ddbb8a53265a16d7d1c Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 10 Apr 2017 09:41:55 -0400 Subject: [PATCH] Use correct dialect for escaping functions. Column functions are currently escaped with the same dialect that is being used by Superset for its metadata storage. Instead the dialect of the target table should be used when escaping column names. --- superset/connectors/sqla/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py index 903182de46b4..bae487b59e11 100644 --- a/superset/connectors/sqla/models.py +++ b/superset/connectors/sqla/models.py @@ -572,6 +572,7 @@ def fetch_metadata(self): M = SqlMetric # noqa metrics = [] any_date_col = None + db_dialect = self.database.get_sqla_engine().dialect for col in table.columns: try: datatype = "{}".format(col.type).upper() @@ -603,7 +604,7 @@ def fetch_metadata(self): any_date_col = col.name quoted = "{}".format( - column(dbcol.column_name).compile(dialect=db.engine.dialect)) + column(dbcol.column_name).compile(dialect=db_dialect)) if dbcol.sum: metrics.append(M( metric_name='sum__' + dbcol.column_name,