|
19 | 19 | from metricflow.dataset.convert_data_source import DataSourceToDataSetConverter
|
20 | 20 | from metricflow.engine.models import Dimension, Materialization, Metric
|
21 | 21 | from metricflow.engine.time_source import ServerTimeSource
|
22 |
| -from metricflow.engine.utils import build_user_configured_model_from_config, build_user_configured_model_from_dbt_config |
| 22 | +from metricflow.engine.utils import build_user_configured_model_from_config |
23 | 23 | from metricflow.execution.execution_plan import ExecutionPlan, SqlQuery
|
24 | 24 | from metricflow.execution.execution_plan_to_text import execution_plan_to_text
|
25 | 25 | from metricflow.execution.executor import SequentialPlanExecutor
|
@@ -276,6 +276,13 @@ def from_config(handler: YamlFileHandler) -> MetricFlowEngine:
|
276 | 276 | # Ideally we should put this getting of of CONFIG_DBT_REPO in a helper
|
277 | 277 | dbt_repo = handler.get_value(CONFIG_DBT_REPO) or ""
|
278 | 278 | if dbt_repo.lower() in ["yes", "y", "true", "t", "1"]:
|
| 279 | + # This import results in eventually importing dbt, and dbt is an |
| 280 | + # optional dep meaning it isn't guaranteed to be installed. If the |
| 281 | + # import is at the top ofthe file MetricFlow will blow up if dbt |
| 282 | + # isn't installed. Thus by importing it here, we only run into the |
| 283 | + # exception if this conditional is hit without dbt installed |
| 284 | + from metricflow.engine.utils import build_user_configured_model_from_dbt_config |
| 285 | + |
279 | 286 | semantic_model = SemanticModel(build_user_configured_model_from_dbt_config(handler))
|
280 | 287 | else:
|
281 | 288 | semantic_model = SemanticModel(build_user_configured_model_from_config(handler))
|
|
0 commit comments