From 993e3a9c1741892bf0f37bbf3f96095125a89f49 Mon Sep 17 00:00:00 2001 From: Thomas Schmidt Date: Mon, 29 Jan 2024 17:23:11 +0100 Subject: [PATCH] Use default target path for dbt --- src/sql_mock/dbt.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sql_mock/dbt.py b/src/sql_mock/dbt.py index bb1a643..2761456 100644 --- a/src/sql_mock/dbt.py +++ b/src/sql_mock/dbt.py @@ -12,11 +12,13 @@ if TYPE_CHECKING: from sql_mock.table_mocks import BaseTableMock +DBT_DEFAULT_TARGET_PATH = "target" + def _get_manifest_from_project_file(project_path: str) -> dict: with open(project_path, "r") as f: dbt_project = yaml.safe_load(f) - target_path = dbt_project["target-path"] + target_path = dbt_project.get("target-path", DBT_DEFAULT_TARGET_PATH) project_dir = os.path.dirname(project_path) with open(os.path.join(project_dir, target_path, "manifest.json"), "r") as file: manifest = json.load(file) @@ -144,9 +146,7 @@ def dbt_source_meta( def decorator(cls): path = project_path or SQLMockConfig.get_dbt_project_path() - dbt_meta = _get_source_metadata( - project_path=path, source_name=source_name, table_name=table_name - ) + dbt_meta = _get_source_metadata(project_path=path, source_name=source_name, table_name=table_name) if default_inputs: validate_input_mocks(default_inputs)