Skip to content

Commit

Permalink
fix(doc): Allow copying asset when dbt docs command is run outside th…
Browse files Browse the repository at this point in the history
…e dbt project
  • Loading branch information
cedric-orange committed Jan 16, 2025
1 parent 3de3b82 commit 7d1f3df
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20250116-192616.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Allow copying asset when dbt docs command is run outside the dbt project
time: 2025-01-16T19:26:16.160976423Z
custom:
Author: cedric-orange
Issue: "9308"
35 changes: 35 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "Python 3",
"image": "docker.io/python:3.12",

"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/common-utils:2": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers-extra/features/gh-release:1": {
"repo": "miniscruff/changie",
"binaryNames": ["changie"]
},
"ghcr.io/devcontainers-extra/features/pre-commit:2": {},
"ghcr.io/jungaretti/features/make:1": {},
"ghcr.io/devcontainers-extra/features/apt-get-packages:1": {
"packages": ["postgresql-client"]
}
},

"postCreateCommand": "make dev",

"customizations": {
"vscode": {
"extensions": [
"mhutchie.git-graph",
"ms-python.python",
"ms-python.flake8",
"ms-python.black-formatter"
]
}
},

"runArgs": ["-e", "GITHUB_TOKEN=${localEnv:GITHUB_TOKEN}"]

}
6 changes: 4 additions & 2 deletions core/dbt/task/docs/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,10 @@ def run(self) -> CatalogArtifact:
if os.path.exists(to_asset_path):
shutil.rmtree(to_asset_path)

if os.path.exists(asset_path):
shutil.copytree(asset_path, to_asset_path)
from_asset_path = os.path.join(self.config.project_root, asset_path)

if os.path.exists(from_asset_path):
shutil.copytree(from_asset_path, to_asset_path)

if self.manifest is None:
raise DbtInternalError("self.manifest was None in run!")
Expand Down

0 comments on commit 7d1f3df

Please sign in to comment.