From 3e2296a0d7ee82d51ddc0314f73dddb4d768287e Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Wed, 11 Dec 2024 13:53:44 -0800 Subject: [PATCH] Rename `convert_to_sql_query_plan`. --- metricflow/execution/dataflow_to_execution.py | 2 +- metricflow/plan_conversion/dataflow_to_sql.py | 2 +- metricflow/validation/data_warehouse_model_validator.py | 2 +- tests_metricflow/examples/test_node_sql.py | 4 ++-- tests_metricflow/plan_conversion/test_dataflow_to_sql_plan.py | 4 ++-- tests_metricflow/query_rendering/compare_rendered_query.py | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/metricflow/execution/dataflow_to_execution.py b/metricflow/execution/dataflow_to_execution.py index bdead7e8a..1ac24df69 100644 --- a/metricflow/execution/dataflow_to_execution.py +++ b/metricflow/execution/dataflow_to_execution.py @@ -72,7 +72,7 @@ def __init__( def _convert_to_sql_plan(self, node: DataflowPlanNode) -> ConvertToSqlPlanResult: logger.debug(LazyFormat(lambda: f"Generating SQL query plan from {node.node_id}")) - result = self._sql_plan_converter.convert_to_sql_query_plan( + result = self._sql_plan_converter.convert_to_sql_plan( sql_engine_type=self._sql_client.sql_engine_type, optimization_level=self._optimization_level, dataflow_plan_node=node, diff --git a/metricflow/plan_conversion/dataflow_to_sql.py b/metricflow/plan_conversion/dataflow_to_sql.py index 6d8d61ec2..991a537d8 100644 --- a/metricflow/plan_conversion/dataflow_to_sql.py +++ b/metricflow/plan_conversion/dataflow_to_sql.py @@ -179,7 +179,7 @@ def __init__( def column_association_resolver(self) -> ColumnAssociationResolver: # noqa: D102 return self._column_association_resolver - def convert_to_sql_query_plan( + def convert_to_sql_plan( self, sql_engine_type: SqlEngine, dataflow_plan_node: DataflowPlanNode, diff --git a/metricflow/validation/data_warehouse_model_validator.py b/metricflow/validation/data_warehouse_model_validator.py index 3c97b8f8e..0d71120e1 100644 --- a/metricflow/validation/data_warehouse_model_validator.py +++ b/metricflow/validation/data_warehouse_model_validator.py @@ -125,7 +125,7 @@ def renderize( sql_client: SqlClient, plan_converter: DataflowToSqlPlanConverter, plan_id: str, nodes: FilterElementsNode ) -> Tuple[str, SqlBindParameterSet]: """Generates a sql query plan and returns the rendered sql and bind_parameter_set.""" - conversion_result = plan_converter.convert_to_sql_query_plan( + conversion_result = plan_converter.convert_to_sql_plan( sql_engine_type=sql_client.sql_engine_type, dataflow_plan_node=nodes, ) diff --git a/tests_metricflow/examples/test_node_sql.py b/tests_metricflow/examples/test_node_sql.py index 267f1f30a..d41bb9394 100644 --- a/tests_metricflow/examples/test_node_sql.py +++ b/tests_metricflow/examples/test_node_sql.py @@ -53,7 +53,7 @@ def test_view_sql_generated_at_a_node( # Show SQL and spec set at a source node. bookings_source_data_set = to_data_set_converter.create_sql_source_data_set(bookings_semantic_model) read_source_node = ReadSqlSourceNode.create(bookings_source_data_set) - conversion_result = to_sql_plan_converter.convert_to_sql_query_plan( + conversion_result = to_sql_plan_converter.convert_to_sql_plan( sql_engine_type=sql_client.sql_engine_type, dataflow_plan_node=read_source_node, ) @@ -81,7 +81,7 @@ def test_view_sql_generated_at_a_node( ), ), ) - conversion_result = to_sql_plan_converter.convert_to_sql_query_plan( + conversion_result = to_sql_plan_converter.convert_to_sql_plan( sql_engine_type=sql_client.sql_engine_type, dataflow_plan_node=filter_elements_node, ) diff --git a/tests_metricflow/plan_conversion/test_dataflow_to_sql_plan.py b/tests_metricflow/plan_conversion/test_dataflow_to_sql_plan.py index f5fff2b29..050926f1c 100644 --- a/tests_metricflow/plan_conversion/test_dataflow_to_sql_plan.py +++ b/tests_metricflow/plan_conversion/test_dataflow_to_sql_plan.py @@ -64,7 +64,7 @@ def convert_and_check( ) -> None: """Convert the dataflow plan to SQL and compare with snapshots.""" # Generate plans w/o optimizers - conversion_result = dataflow_to_sql_converter.convert_to_sql_query_plan( + conversion_result = dataflow_to_sql_converter.convert_to_sql_plan( sql_engine_type=sql_client.sql_engine_type, sql_query_plan_id=DagId.from_str("plan0"), dataflow_plan_node=node, @@ -91,7 +91,7 @@ def convert_and_check( ) # Generate plans with optimizers - conversion_result = dataflow_to_sql_converter.convert_to_sql_query_plan( + conversion_result = dataflow_to_sql_converter.convert_to_sql_plan( sql_engine_type=sql_client.sql_engine_type, sql_query_plan_id=DagId.from_str("plan0_optimized"), dataflow_plan_node=node, diff --git a/tests_metricflow/query_rendering/compare_rendered_query.py b/tests_metricflow/query_rendering/compare_rendered_query.py index e9e17cd56..d8c467f5e 100644 --- a/tests_metricflow/query_rendering/compare_rendered_query.py +++ b/tests_metricflow/query_rendering/compare_rendered_query.py @@ -31,7 +31,7 @@ def render_and_check( base_plan = dataflow_plan_builder.build_plan_for_distinct_values(query_spec=query_spec) else: base_plan = dataflow_plan_builder.build_plan(query_spec) - conversion_result = dataflow_to_sql_converter.convert_to_sql_query_plan( + conversion_result = dataflow_to_sql_converter.convert_to_sql_plan( sql_engine_type=sql_client.sql_engine_type, dataflow_plan_node=base_plan.sink_node, optimization_level=SqlOptimizationLevel.O0, @@ -60,7 +60,7 @@ def render_and_check( optimized_plan = dataflow_plan_builder.build_plan( query_spec, optimizations=DataflowPlanOptimization.enabled_optimizations() ) - conversion_result = dataflow_to_sql_converter.convert_to_sql_query_plan( + conversion_result = dataflow_to_sql_converter.convert_to_sql_plan( sql_engine_type=sql_client.sql_engine_type, dataflow_plan_node=optimized_plan.sink_node, sql_query_plan_id=DagId.from_str("plan0_optimized"),