villebro commented on a change in pull request #17237:
URL: https://github.com/apache/superset/pull/17237#discussion_r737150563
##########
File path: superset/connectors/sqla/models.py
##########
@@ -322,7 +322,9 @@ def get_timestamp_expression(
sqla_col = column(self.column_name, type_=type_)
return self.table.make_sqla_column_compatible(sqla_col, label)
if self.expression:
- col = literal_column(self.expression, type_=type_)
+ tp = self.table.get_template_processor()
+ expression = tp.process_template(self.expression)
+ col = literal_column(expression, type_=type_)
Review comment:
To make sure the template processor has access to all query parameters
which are defined early in the `get_sqla_query` method (see
https://github.com/apache/superset/blob/4316fe6ae64522ff5ac31383b378b94be786ad60/superset/connectors/sqla/models.py#L970-L982),
it would be nice to pass the template processor (declared here:
https://github.com/apache/superset/blob/4316fe6ae64522ff5ac31383b378b94be786ad60/superset/connectors/sqla/models.py#L995)
as an optional parameter to `get_timesstamp_expression` that can then be used
if available.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]