Skip to content

Commit 7d712c7

Browse files
Fix dbt clean: run dbt deps after clean to reinstall packages
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
1 parent 0b60560 commit 7d712c7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

integration_tests/tests/dbt_project.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,16 @@ def clean(self):
278278
This is useful for dbt-fusion which caches column information. When tables
279279
are recreated with different columns, the cache becomes stale. Running clean
280280
invalidates the cache and forces fresh queries to the warehouse.
281+
282+
Note: dbt clean removes the dbt_packages directory, so we need to run
283+
dbt deps afterwards to reinstall the packages.
281284
"""
282285
cmd = ["dbt", "clean", "--project-dir", str(self.project_dir_path)]
283286
if self.target:
284287
cmd.extend(["--target", self.target])
285288
logger.info(f"Running dbt clean: {' '.join(cmd)}")
286289
subprocess.run(cmd, check=True, capture_output=True)
290+
self.dbt_runner.deps(quiet=True)
287291

288292
@contextmanager
289293
def seed_context(

0 commit comments

Comments
 (0)