-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Problem with Flask-SQLAlchemy, cannot find valid and existing property in SQLAlchemy object. #1973
Comments
Thanks, I think we don't understand any of Sqlalchemy's library. This might require some updates in astroid's brain tips to support sqlalchemy by providing hints on how the library looks. |
I added a solution at microsoft/vscode-python#292 Let me know if that helped !!! |
@anselal changing linter seems to be workaround but not a solution |
I guess you are right @ibakirov |
Bump. Same problem.
Current solution for me is to disable pylint and use flake8. |
@changeling yes, I'm still using @anselal's workaround |
For folks commenting here about switching to flake8, there are multiple solutions to this problem without waiting for a solution from
Coming here and commenting that switching to flake8 is a solution to your problem means that you were never interested in the first place to fix it using what And as I mentioned earlier, we don't support sqlalchemy out of the box. Understanding Python code is hard, understanding it when it uses metaclasses and/or other dynamic features is next to impossible, which exactly what is happening with |
How does flake8 deal with it ? |
It doesn't. |
I find an elegant solution here: https://stackoverflow.com/questions/28193025/pylint-cant-find-sqlalchemy-query-member Solution
Load the installed plugin. For example, if you use VS code, please edit
|
After installing the pylint-flask, I stop getting errors at all. |
Thank you, it's work for me. |
@YoungWilliamZ Is there a solution for newest flask? pylint-flask supports only flask.ext imports, and I don't have those |
@Turbid However, it also stops detecting other errors. For example: but it also does not show error for |
Is there still no official solution to this issue? I don't want to have to use @YoungWilliamZ solution. |
@elamje This is as official as it gets: #1973 (comment) |
@elamje : I wrote a small pylint plugin to fix these issues : pylint-flask-sqlalchemy if you want to try it. |
|
Unfortunately, when I installed pylint-flask and added the entry in setting.json, I still got the no member message, along with a whole bunch of others... |
+1 on @dxkaufman |
Use pylint plugin pylint-flask-sqlalchemy
And in your settings.json of VisualCode
|
"pylint_flask_sqlalcheny" or "pylint_flask_sqlalchemy"? |
pylint_flask_sqlalchemy, little typo :-) |
@herrboyer can't figure out how to contribute on the anycloud site, and this seems like the place people are chatting about your plugin. Is there anyway to have your pylint plugin recognize sqlalchemy's ie: class User:
name = db.Column(db.String)
best_friend = db.relationship(User)
def best_friends_name(self):
return self.best_friend.name Code like that is showing errors for |
Hi @btoconnor sorry for the delay... I made a mirror of the repo on github https://github.com/anybox/pylint_flask_sqlalchemy feel free to raise an issue here (btw I was not able to reproduce your problem, I even updated the test data to include a db.relationship) |
@YoungWilliamZ |
Where do i run it? |
My bad already find. |
Steps to reproduce
Current behavior
severity: 'Error'
message: 'E1101:Instance of 'SQLAlchemy' has no 'Column' member'
at: '14,10'
source: 'pylint'
code: 'E1101'
Expected behavior
No errors (since code / application works as expected)
pylint --version output
No config file found, using default configuration
pylint 1.8.3,
astroid 1.6.2
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)]
For more details check following thread:
microsoft/vscode-python#292
The text was updated successfully, but these errors were encountered: