mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
feat: supporting jinja templating in saved metrics (#15502)
* feat: supporting jinja templating in saved metrics * cutting the line length to fit requirements * follwing PR I should have not created a new insance method * running precommit locally and fixing the issue Co-authored-by: Guy <guy@nexite.io>
This commit is contained in:
parent
15796ea4ac
commit
bee386e643
@ -413,7 +413,8 @@ class SqlMetric(Model, BaseMetric):
|
|||||||
|
|
||||||
def get_sqla_col(self, label: Optional[str] = None) -> Column:
|
def get_sqla_col(self, label: Optional[str] = None) -> Column:
|
||||||
label = label or self.metric_name
|
label = label or self.metric_name
|
||||||
sqla_col: ColumnClause = literal_column(self.expression)
|
tp = self.table.get_template_processor()
|
||||||
|
sqla_col: ColumnClause = literal_column(tp.process_template(self.expression))
|
||||||
return self.table.make_sqla_column_compatible(sqla_col, label)
|
return self.table.make_sqla_column_compatible(sqla_col, label)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
Reference in New Issue
Block a user