Skip to content

Commit

Permalink
Remove project pipeline_dir as it is redundant
Browse files Browse the repository at this point in the history
  • Loading branch information
tatiana committed Jul 17, 2023
1 parent 47beb83 commit 6d09ee5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions cosmos/dbt/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
class DbtProject:
name: str
root_dir: Path
pipeline_dir: Path | None = None
models_dir: Path | None = None
seeds_dir: Path | None = None
snapshots_dir: Path | None = None
Expand All @@ -19,29 +18,30 @@ class DbtProject:
_cosmos_created_profile_file: bool = False

def __post_init__(self):
if self.pipeline_dir is None:
self.pipeline_dir = self.root_dir / self.name
if self.models_dir is None:
self.models_dir = self.pipeline_dir / "models"
self.models_dir = self.dir / "models"
if self.seeds_dir is None:
self.seeds_dir = self.pipeline_dir / "seeds"
self.seeds_dir = self.dir / "seeds"
if self.snapshots_dir is None:
self.snapshots_dir = self.pipeline_dir / "snapshots"
self.snapshots_dir = self.dir / "snapshots"
if self.profile_path is None:
self.profile_path = self.pipeline_dir / "profiles.yml"
self.profile_path = self.dir / "profiles.yml"

@property
def dir(self) -> Path:
"""
Path to dbt pipeline, defined by self.root_dir and self.name.
"""
return self.root_dir / self.name

def is_manifest_available(self) -> bool:
"""
Checks if the `dbt` project manifest is set and if the file exists.
Check if the `dbt` project manifest is set and if the file exists.
"""
return self.manifest_path and Path(self.manifest_path).exists()

def is_profile_yml_available(self) -> bool:
"""
Checks if the `dbt` profiles.yml file exists.
Check if the `dbt` profiles.yml file exists.
"""
return Path(self.profile_path).exists()

0 comments on commit 6d09ee5

Please sign in to comment.