diff --git a/metricflow/engine/metricflow_engine.py b/metricflow/engine/metricflow_engine.py index f494a4b44..f0c582554 100644 --- a/metricflow/engine/metricflow_engine.py +++ b/metricflow/engine/metricflow_engine.py @@ -182,16 +182,26 @@ def sql_statement(self) -> SqlStatement: execution_plan = self.execution_plan if len(execution_plan.tasks) != 1: raise NotImplementedError( - f"Multiple tasks in the execution plan not yet supported. Got tasks: {execution_plan.tasks}" + str( + LazyFormat( + "Multiple tasks in the execution plan not yet supported.", + tasks=[task.task_id for task in execution_plan.tasks], + ) + ) ) - sql_query = execution_plan.tasks[0].sql_statement - if not sql_query: + sql_statement = execution_plan.tasks[0].sql_statement + if not sql_statement: raise NotImplementedError( - f"Execution plan tasks without a SQL query not yet supported. Got tasks: {execution_plan.tasks}" + str( + LazyFormat( + "Execution plan tasks without a SQL statement are not yet supported.", + tasks=[task.task_id for task in execution_plan.tasks], + ) + ) ) - return sql_query + return sql_statement @property def rendered_sql_without_descriptions(self) -> SqlStatement: diff --git a/metricflow/execution/execution_plan.py b/metricflow/execution/execution_plan.py index 9da7d39a1..c3e044a6f 100644 --- a/metricflow/execution/execution_plan.py +++ b/metricflow/execution/execution_plan.py @@ -122,9 +122,8 @@ def description(self) -> str: # noqa: D102 @property def displayed_properties(self) -> Sequence[DisplayedProperty]: # noqa: D102 - sql_query = self.sql_statement - assert sql_query is not None, f"{self.sql_statement=} should have been set during creation." - return tuple(super().displayed_properties) + (DisplayedProperty(key="sql_query", value=sql_query.sql),) + assert self.sql_statement is not None, f"{self.sql_statement=} should have been set during creation." + return tuple(super().displayed_properties) + (DisplayedProperty(key="sql", value=self.sql_statement.sql),) def execute(self) -> TaskExecutionResult: # noqa: D102 start_time = time.time()