superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ville...@apache.org
Subject [incubator-superset] branch master updated: bugfix: Oracle timegrains fail to render when wrapped in outer query (#7767)
Date Wed, 26 Jun 2019 05:56:27 GMT
This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new ebb7fbc  bugfix: Oracle timegrains fail to render when wrapped in outer query (#7767)
ebb7fbc is described below

commit ebb7fbc5f024379361f301a86b770e0cc1a932cd
Author: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
AuthorDate: Wed Jun 26 08:56:19 2019 +0300

    bugfix: Oracle timegrains fail to render when wrapped in outer query (#7767)
    
    * Add check if TimegrainExpression col is None
    
    * Clean up TimestampExpression proxying logic
    
    * Remove redundant optionality from init
---
 superset/db_engine_specs/base.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/superset/db_engine_specs/base.py b/superset/db_engine_specs/base.py
index 83e64bb..eced6bb 100644
--- a/superset/db_engine_specs/base.py
+++ b/superset/db_engine_specs/base.py
@@ -78,6 +78,13 @@ class TimestampExpression(ColumnClause):
         super().__init__(expr, **kwargs)
         self.col = col
 
+    @property
+    def _constructor(self):
+        # Needed to ensure that the column label is rendered correctly when
+        # proxied to the outer query.
+        # See https://github.com/sqlalchemy/sqlalchemy/issues/4730
+        return ColumnClause
+
 
 @compiles(TimestampExpression)
 def compile_timegrain_expression(element: TimestampExpression, compiler, **kw):
@@ -123,9 +130,9 @@ class BaseEngineSpec(object):
         cls, col: ColumnClause, pdf: Optional[str], time_grain: Optional[str]
     ) -> TimestampExpression:
         """
-        Construct a TimeExpression to be used in a SQLAlchemy query.
+        Construct a TimestampExpression to be used in a SQLAlchemy query.
 
-        :param col: Target column for the TimeExpression
+        :param col: Target column for the TimestampExpression
         :param pdf: date format (seconds or milliseconds)
         :param time_grain: time grain, e.g. P1Y for 1 year
         :return: TimestampExpression object


Mime
View raw message