Skip to content

Commit

Permalink
[bufix] superset views not getting from_dttm-to_dttm in template cont…
Browse files Browse the repository at this point in the history
…ext (#2978)
  • Loading branch information
mistercrunch authored Jun 16, 2017
1 parent 7122974 commit 89cd10b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions superset/connectors/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,13 @@ def get_sqla_table(self):
tbl.schema = self.schema
return tbl

def get_from_clause(self):
def get_from_clause(self, template_processor=None):
# Supporting arbitrary SQL statements in place of tables
if self.sql:
tp = self.get_template_processor()
from_sql = tp.process_template(self.sql)
from_sql = self.sql
if template_processor:
from_sql = template_processor.process_template(from_sql)
return TextAsFrom(sa.text(from_sql), []).alias('expr_qry')

return self.get_sqla_table()

def get_sqla_query( # sqla
Expand Down Expand Up @@ -444,7 +444,7 @@ def get_sqla_query( # sqla
select_exprs += metrics_exprs
qry = sa.select(select_exprs)

tbl = self.get_from_clause()
tbl = self.get_from_clause(template_processor)

if not columns:
qry = qry.group_by(*groupby_exprs)
Expand Down

0 comments on commit 89cd10b

Please sign in to comment.