You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by GitBox <gi...@apache.org> on 2017/12/23 12:40:33 UTC

[GitHub] xrmx commented on a change in pull request #4109: Apply time filter to time grain truncated dates #3538

xrmx commented on a change in pull request #4109: Apply time filter to time grain truncated dates #3538
URL: https://github.com/apache/incubator-superset/pull/4109#discussion_r158581790
 
 

 ##########
 File path: superset/connectors/sqla/models.py
 ##########
 @@ -97,13 +97,19 @@ def sqla_col(self):
             col = literal_column(self.expression).label(name)
         return col
 
-    def get_time_filter(self, start_dttm, end_dttm):
+    def get_time_filter(self, start_dttm, end_dttm, grain):
         col = self.sqla_col.label('__time')
         l = []  # noqa: E741
         if start_dttm:
-            l.append(col >= text(self.dttm_sql_literal(start_dttm)))
+            if grain:
 
 Review comment:
   These conditionals could be moved to an helper:
   ```
   def get_time_filter_condition(dttm, grain):
       if grain:
           return col >= text(grain.function.format(col="'%s'" % dttm)
       return col >= text(self.dttm_sql_literal(dttm))
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services