[bugfix] text as subquery fails with 'Series Limit' (#1347)

This commit is contained in:
Maxime Beauchemin 2016-10-17 18:36:49 -07:00 committed by GitHub
parent ecb951bb74
commit 8f299448ea
2 changed files with 3 additions and 1 deletions

View File

@ -988,7 +988,7 @@ class SqlaTable(Model, Queryable, AuditMixinNullable, ImportMixin):
# Supporting arbitrary SQL statements in place of tables
if self.sql:
tbl = text('(' + self.sql + ') as expr_qry ')
tbl = TextAsFrom(sqla.text(self.sql), []).alias('expr_qry')
if not columns:
qry = qry.group_by(*groupby_exprs)

View File

@ -1849,6 +1849,8 @@ class Caravel(BaseCaravelView):
'groupby': dims[0].column_name if dims else '',
'metrics': metrics[0].metric_name if metrics else '',
'metric': metrics[0].metric_name if metrics else '',
'since': '100 years ago',
'limit': '0',
}
params = "&".join([k + '=' + v for k, v in params.items()])
url = '/caravel/explore/table/{table.id}/?{params}'.format(**locals())