Raise a warning for required, but uninstalled packages
See original GitHub issueDescribe the feature
The error message for an uninstalled package comes straight out of the Jinja library:
Compilation Error in analysis scratch (analysis/scratch.sql)
'dbt_utils' is undefined
This error message is strictly true, but I think it might be worth taking the time to write a more explicit warning message for uninstalled packages
Warning: The following packages are listed as required in `packages.yml` but have not been installed
- dbt_utils
Run `dbt deps` to install these packages
Since we have the expected packages in packages.yml
and the installed packages in dbt_modules
, this should be possible, right? And not that hard?
Note: I’ve only got it as a warning so that the places where the package is referenced still causes an error, but I’m open to having this as an error instead
Describe alternatives you’ve considered
Keep as is
Who will this benefit?
Confused users
Are you interested in contributing this feature?
No ty 😃
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Raise a warning for required, but uninstalled packages #2999
Describe the feature The error message for an uninstalled package comes straight out of the Jinja library: Compilation Error in analysis ...
Read more >How to Fix Pip “Yanked Version” Warnings - Adam Johnson
To fix a yanked version warning, we need to find an un-yanked version of the package that will work for us. This might...
Read more >warnings — Warning control — Python 3.11.1 documentation
Commonly used warning filters apply to either all warnings, warnings in a particular category, or warnings raised by particular modules or packages.
Read more >pip cannot uninstall <package>: "It is a distutils installed project"
This error means that this package's metadata doesn't include a list of files that belong to it. Most probably, you have installed this ......
Read more >How to capture warnings — pytest documentation
Although not recommended, you can use the --disable-warnings command-line option to suppress the warning summary entirely from the test run output. Disabling ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jaypeedevlin I don’t know why I thought this would be so tricky! At the prompting of your PR comment, I took a look down this code path, and I think it could be as simple as sticking a check right in
load_dependencies
: https://github.com/fishtown-analytics/dbt/blob/1f33b6a74a614aa346824f16c5629e4d910d2106/core/dbt/config/runtime.py#L327-L334We can’t match on names, since
self.packages.packages
is just the info frompackages.yml
(which may or may not match the package name, if it’s a git repo name or local directory). We also can’t check lengths for perfect equality, since it’s possible thatcount_packages_installed
will be greater thancount_packages_installed
, if the specified packages have package dependencies of their own. But I’d say this is a lot better than nothing, and I’d be excited about pairing it with the kinderUndefinedMacroException
you’ve got over in #3343.@jtcohen6 I’d love to jump onto this one in the next day or so.
Just to clarify, regarding:
Will catching and reraising the exception be enough, or do I also need to modify
exceptions.py
?