Skip to content

Commit

Permalink
Update local variable names and fix logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
plypaul committed Dec 14, 2024
1 parent 3c13f7b commit a665720
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
20 changes: 15 additions & 5 deletions metricflow/engine/metricflow_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 2 additions & 3 deletions metricflow/execution/execution_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a665720

Please sign in to comment.