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(self, 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:
[email protected]


With regards,
Apache Git Services

Reply via email to