Skip to content

Commit

Permalink
[components] Fix generated path to dbt project (#26384)
Browse files Browse the repository at this point in the history
## Summary & Motivation

CWD is not what is expected causing the dbt project path to be wrong
when it is calculated as a relative path of the CWD. This PR introduces
a hack with a hardcoded correction. We will fix the root problem of the
CWD in a followup.

## How I Tested These Changes

Manually, observed correct path being generated.
  • Loading branch information
smackesey authored Dec 10, 2024
1 parent 2404f13 commit 51b196c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ def _fn(context: AssetExecutionContext, dbt: DbtCliResource):
def generate_files(cls, params: DbtGenerateParams) -> Mapping[str, Any]:
cwd = os.getcwd()
if params.project_path:
relative_path = os.path.relpath(params.project_path, start=cwd)
# NOTE: CWD is not set "correctly" above so we prepend "../../.." as a temporary hack to
# make sure the path is right.
relative_path = os.path.join(
"../../../", os.path.relpath(params.project_path, start=cwd)
)
elif params.init:
dbtRunner().invoke(["init"])
subpaths = [
Expand Down

0 comments on commit 51b196c

Please sign in to comment.