Skip to content

Commit

Permalink
Use default target path for dbt
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Schmidt committed Jan 29, 2024
1 parent 0658cbc commit 993e3a9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sql_mock/dbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 993e3a9

Please sign in to comment.