villebro commented on a change in pull request #8398: [SIP-15] Adding initial
framework
URL:
https://github.com/apache/incubator-superset/pull/8398#discussion_r335274679
##########
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:
Shouldn't the start endpoint apply to `start_dttm`, too?
----------------------------------------------------------------
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]