From e81f7fdbd5b248d7cc24847da1ac6eee453f9d1a Mon Sep 17 00:00:00 2001 From: Doug Beatty <44704949+dbeatty10@users.noreply.github.com> Date: Fri, 5 Apr 2024 15:26:52 -0600 Subject: [PATCH] Only create the `packages-install-path` / `dbt_packages` folder during `dbt deps` (#9810) * Changelog entry * The packages-install-path should not be created by `dbt list` * Only create packages-install-path during `dbt deps` --- .changes/unreleased/Fixes-20240323-124558.yaml | 6 ++++++ core/dbt/compilation.py | 1 - tests/functional/list/test_list.py | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Fixes-20240323-124558.yaml diff --git a/.changes/unreleased/Fixes-20240323-124558.yaml b/.changes/unreleased/Fixes-20240323-124558.yaml new file mode 100644 index 00000000000..b36173325ba --- /dev/null +++ b/.changes/unreleased/Fixes-20240323-124558.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Only create the packages-install-path / dbt_packages folder during dbt deps +time: 2024-03-23T12:45:58.159017-06:00 +custom: + Author: dbeatty10 + Issue: 6985 9584 diff --git a/core/dbt/compilation.py b/core/dbt/compilation.py index 388713842ed..09695fc59d7 100644 --- a/core/dbt/compilation.py +++ b/core/dbt/compilation.py @@ -274,7 +274,6 @@ def __init__(self, config) -> None: def initialize(self): make_directory(self.config.project_target_path) - make_directory(self.config.packages_install_path) # creates a ModelContext which is converted to # a dict for jinja rendering of SQL diff --git a/tests/functional/list/test_list.py b/tests/functional/list/test_list.py index b636bf20d39..4eb8cb8e2f9 100644 --- a/tests/functional/list/test_list.py +++ b/tests/functional/list/test_list.py @@ -37,6 +37,13 @@ def project_config_update(self): }, } + def test_packages_install_path_does_not_exist(self, project): + run_dbt(["list"]) + packages_install_path = "dbt_packages" + + # the packages-install-path should not be created by `dbt list` + assert not os.path.exists(packages_install_path) + def run_dbt_ls(self, args=None, expect_pass=True): log_manager.stdout_console() full_args = ["ls"]