fix: Run dbt deps before dbt run to install packages

dbt requires packages specified in packages.yml to be installed
before running models. Added dbt deps step to the pipeline.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-18 12:20:26 -05:00
parent 5839eabf1e
commit 8f3c5554f9

View File

@@ -298,11 +298,25 @@ class DataPipeline:
return False return False
if self.dry_run: if self.dry_run:
logger.info(" [DRY RUN] Would run: dbt deps")
logger.info(" [DRY RUN] Would run: dbt run") logger.info(" [DRY RUN] Would run: dbt run")
logger.info(" [DRY RUN] Would run: dbt test") logger.info(" [DRY RUN] Would run: dbt test")
return True return True
try: try:
# Install dbt packages if needed
logger.info(" Running dbt deps...")
result = subprocess.run(
[dbt_cmd, "deps", "--profiles-dir", str(dbt_project_dir)],
cwd=dbt_project_dir,
capture_output=True,
text=True,
)
if result.returncode != 0:
logger.error(f"dbt deps failed:\n{result.stdout}\n{result.stderr}")
return False
# Run dbt models # Run dbt models
logger.info(" Running dbt run...") logger.info(" Running dbt run...")
result = subprocess.run( result = subprocess.run(