Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cosmos/dbt/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
import platform
import tempfile
import warnings
import zlib
from dataclasses import dataclass, field
from functools import cached_property
Expand Down Expand Up @@ -836,6 +837,11 @@ def load_via_custom_parser(self) -> None:
* self.filtered_nodes
"""
self.load_method = LoadMode.CUSTOM
warnings.warn(
"Using `load_method` = `LoadMode.CUSTOM` is deprecated in current version and will"
" be removed in Cosmos 2.0",
DeprecationWarning,
)
logger.info("Trying to parse the dbt project `%s` using a custom Cosmos method...", self.project.project_name)

if self.render_config.selector:
Expand Down
25 changes: 25 additions & 0 deletions tests/dbt/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,31 @@ def test_load_via_load_via_custom_parser(project_name, nodes_count):
assert len(dbt_graph.nodes) == nodes_count


@pytest.mark.parametrize("project_name", [("altered_jaffle_shop"), ("jaffle_shop_python")])
def test_validate_load_via_load_via_custom_parser_deprecated(project_name):
"""Deprecating warnings should be raised when using load_mode CUSTOM."""
project_config = ProjectConfig(dbt_project_path=DBT_PROJECTS_ROOT_DIR / project_name)
execution_config = ExecutionConfig(dbt_project_path=DBT_PROJECTS_ROOT_DIR / project_name)
render_config = RenderConfig(
dbt_project_path=DBT_PROJECTS_ROOT_DIR / project_name,
source_rendering_behavior=SOURCE_RENDERING_BEHAVIOR,
)
profile_config = ProfileConfig(
profile_name="test",
target_name="test",
profiles_yml_filepath=DBT_PROJECTS_ROOT_DIR / project_name / "profiles.yml",
)
dbt_graph = DbtGraph(
project=project_config,
profile_config=profile_config,
render_config=render_config,
execution_config=execution_config,
)

with pytest.deprecated_call():
dbt_graph.load_via_custom_parser()


def test_load_via_load_via_custom_parser_select_rendering_config():
project_config = ProjectConfig(dbt_project_path=DBT_PROJECTS_ROOT_DIR / "jaffle_shop")
execution_config = ExecutionConfig(dbt_project_path=DBT_PROJECTS_ROOT_DIR / DBT_PROJECT_NAME)
Expand Down