john-bodley commented on a change in pull request #8398: [SIP-15] Adding
initial framework
URL:
https://github.com/apache/incubator-superset/pull/8398#discussion_r335275435
##########
File path: superset/connectors/sqla/models.py
##########
@@ -159,14 +159,25 @@ def datasource(self) -> RelationshipProperty:
return self.table
def get_time_filter(
- self, start_dttm: DateTime, end_dttm: DateTime
+ self,
+ start_dttm: DateTime,
+ end_dttm: DateTime,
+ time_range_endpoints: Optional[
+ Tuple[utils.TimeRangeEndpoint, utils.TimeRangeEndpoint]
+ ],
) -> ColumnElement:
col = self.get_sqla_col(label="__time")
l = [] # noqa: E741
if start_dttm:
l.append(col >= text(self.dttm_sql_literal(start_dttm)))
if end_dttm:
- l.append(col <= text(self.dttm_sql_literal(end_dttm)))
+ if (
+ time_range_endpoints
+ and time_range_endpoints[1] ==
utils.TimeRangeEndpoint.EXCLUSIVE
+ ):
+ l.append(col < text(self.dttm_sql_literal(end_dttm)))
+ else:
+ l.append(col <= text(self.dttm_sql_literal(end_dttm)))
Review comment:
@villebro the start endpoint is currently correct (though SIP-15/SIP-15A
needs to address aspects where `[start` actually behaves like `(start`). I
guess one could argue for the filtering we really only care about the upper
endpoint, however I have defined both so we can more accurately display how we
believe the time range filter is being applied.
`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]