mirror of
https://github.com/apache/superset.git
synced 2024-09-18 19:49:37 -04:00
Use correct dialect for escaping functions. (#2593)
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.
This commit is contained in:
parent
ab0bc5a3fa
commit
f5489467e5
@ -572,6 +572,7 @@ class SqlaTable(Model, BaseDatasource):
|
||||
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 @@ class SqlaTable(Model, BaseDatasource):
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user