Skip to content

Commit

Permalink
Use correct dialect for escaping functions. (#2593)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
steveniemitz authored and mistercrunch committed Apr 12, 2017
1 parent ab0bc5a commit f548946
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion superset/connectors/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit f548946

Please sign in to comment.