Skip to content

fix(dbt-doc): Allow copying asset when dbt docs command is run outside th… #11219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 3, 2025

Conversation

cedric-orange
Copy link
Contributor

@cedric-orange cedric-orange commented Jan 16, 2025

Resolves #9308

Problem

The directory assets is not being copied to target/assets when running dbt docs generate if you are not in root dbt project.

Solution

Add dbt_project_dir to asset path

Note: I added a devcontainer.json file to have quickly a full-featured development environment

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.

@cedric-orange cedric-orange requested a review from a team as a code owner January 16, 2025 19:46
Copy link

cla-bot bot commented Jan 16, 2025

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @cedric-orange

@github-actions github-actions bot added the community This PR is from a community member label Jan 16, 2025
@cla-bot cla-bot bot added the cla:yes label Jan 16, 2025
@cedric-orange
Copy link
Contributor Author

Before correction, when running dbt docs generate --project-dir myproject assets are missing in target output.

After this fix: there is now a directory on target output containing assets.

Copy link
Contributor

@dataders dataders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR @cedric-orange! You're right that it's a small change.

Two requests:

  1. remove the .devcontainer/devcontainer.json file you've added
  2. if possible add a unit test to ensure we don't break this behavior in future releases. #8388 contains a test that Doug thinks would get you most of the way but needs some tweaking

Looking at the linked issue, there was a unit

@cedric-orange
Copy link
Contributor Author

Thanks for the review, I added a new test according to this topic.

I also remove devcontainer.json file.
I think it would be a good idea to provide a ready-to-use devcontainer for dbt-core.
Do I open another PR with that, or you disagree with it ?

@alexandre-bernard
Copy link

Hello @zqureshi ,

Any update on this issue ?

@zqureshi zqureshi added the ready_for_review Externally contributed PR has functional approval, ready for code review from Core engineering label Apr 1, 2025
@zqureshi zqureshi dismissed dataders’s stale review April 1, 2025 18:57

Concerns have been addressed, unit test added.

Copy link
Member

@zqureshi zqureshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @cedric-orange!

@jtcohen6 and I reviewed and this looks good.

@zqureshi
Copy link
Member

zqureshi commented Apr 1, 2025

Closing and reopening to trigger tests.

@zqureshi zqureshi closed this Apr 1, 2025
@zqureshi zqureshi reopened this Apr 1, 2025
Copy link

codecov bot commented Apr 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.89%. Comparing base (359b195) to head (7c1a160).
Report is 4 commits behind head on main.

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11219      +/-   ##
==========================================
- Coverage   88.90%   88.89%   -0.01%     
==========================================
  Files         194      194              
  Lines       24509    24510       +1     
==========================================
  Hits        21789    21789              
- Misses       2720     2721       +1     
Flag Coverage Δ
integration 85.95% <100.00%> (-0.02%) ⬇️
unit 62.73% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Unit Tests 62.73% <0.00%> (-0.01%) ⬇️
Integration Tests 85.95% <100.00%> (-0.02%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zqureshi
Copy link
Member

zqureshi commented Apr 1, 2025

Hey @cedric-orange there is a github change that went into effect yesterday that is causing one of the CI tests to fail. Once we resolve that (fix is already up) we should be good to merge this.

@zqureshi
Copy link
Member

zqureshi commented Apr 1, 2025

@cedric-orange the fix has been merged, if you want to rebase your changes on top of latest main all check should hopefully pass.

@cedric-orange
Copy link
Contributor Author

@zqureshi This fork has just been updated to sync dbt-core main.

@zqureshi zqureshi merged commit 6b747fe into dbt-labs:main Apr 3, 2025
53 of 54 checks passed
@zqureshi
Copy link
Member

zqureshi commented Apr 3, 2025

Thank you so much @cedric-orange! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes community This PR is from a community member ready_for_review Externally contributed PR has functional approval, ready for code review from Core engineering
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-3509] [Bug] assets not being copied to target directory with docs generate --project-dir
4 participants