-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Feature] Filter standard library packages out of Python models' packages
config
#9875
Comments
Thanks for opening this @gwenwindflower ! Which adapter did you use? Could you provide a simple dbt python model that exhibits this issue? Was it dbt-snowflake with a model like this, by any chance? import pandas as pd
import numpy as np
import re
def model(dbt, session):
dbt.config(packages=["pandas", "numpy", "re"])
df = pd.DataFrame({"hello": ["world"]})
return df And an error like this?
|
hey @dbeatty10, sorry for the lack of a firsthand repro, I reported this based on a user in the Community so didn't get the error myself! @aranke suggested it could be worthwhile to just fix this rather than updating the docs, and I tend to agree, particularly with the offered idea of a clear Warning over a mysterious Error. based on my conversation with the Community-member, this looks like exactly the simplified version of the model he was creating and error he was getting that confused him. Here's a link to the thread. |
@aranke could you share the details of your proposed approach for this scenario? If you can provide links to the relevant area(s) of the source code, that would be even better. |
Code: TK Python built-in modules: https://docs.python.org/3/library/sys.html#sys.builtin_module_names |
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days. |
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers. |
Is this your first time submitting a feature request?
Describe the feature
Right now, if a user wants to use
re
,os
, etc in a Python model, they would rightfully think it important to add it to thepackages
list config argument of the model. In fact, dbt will throw a 'package not found' error for packages that aren't 3rd party. The Right Way at present is to just import and use them, but we don't flag that anywhere in the docs. It would be good to filter out the standard library packages and perhaps throw a warning instead of an error here, letting people know this isn't necessary, but still proceeding.At present you need to do this, which is not super obvious:
Describe alternatives you've considered
Who will this benefit?
Users of Python models.
Are you interested in contributing this feature?
No
Anything else?
The text was updated successfully, but these errors were encountered: