Solvedpylint Problem with Flask-SQLAlchemy, cannot find valid and existing property in SQLAlchemy object.

Steps to reproduce

  1. Install Visual Studio Code
  2. Install python support and install pylint
  3. Setup basic flask app
  4. Create Blueprint and import db from main init.py

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

29 Answers

✔️Accepted Answer

I find an elegant solution here: https://stackoverflow.com/questions/28193025/pylint-cant-find-sqlalchemy-query-member

Solution

pip install pylint-flask

Load the installed plugin.

For example, if you use VS code, please edit setting.json file as follows:

"python.linting.pylintArgs": ["--load-plugins", "pylint_flask"]

Other Answers:

@elamje : I wrote a small pylint plugin to fix these issues : pylint-flask-sqlalchemy if you want to try it.

For folks commenting here about switching to flake8, there are multiple solutions to this problem without waiting for a solution from pylint itself:

  • run it with --generated-members=Column
  • or maybe --ignored-classes=SQLAlchemy
  • or disable no-member locally where the error is emitted
  • or even disable it globally

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 pylint offers you already.

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 sqlalchemy and flask_sqlalchemy.

Use pylint plugin pylint-flask-sqlalchemy

pip install pylint_flask_sqlalchemy

And in your settings.json of VisualCode

"python.linting.pylintArgs": ["--load-plugins", "pylint_flask_sqlalchemy"]

@YoungWilliamZ Is there a solution for newest flask? pylint-flask supports only flask.ext imports, and I don't have those

Related Issues:

256
pylint cv2 module members are not recognized
On VScode: CTRL + Shift + P Choose Preferences: Open Settings (JSON) Add this line into JSON file: p...
83
pylint logging-format-interpolation for f-strings
Please not! f-Strings are more readable and fast Pylint will warn against using .format and % when l...
58
pylint Problem with Flask-SQLAlchemy, cannot find valid and existing property in SQLAlchemy object.
I find an elegant solution here: https://stackoverflow.com/questions/28193025/pylint-cant-find-sqlal...
33
pylint --fail-under flag
@PCManticore @brycepg Please consider re-opening this This is a useful feature coverage also has sim...
15
pylint [Python 3.9] Value 'Optional' is unsubscriptable (unsubscriptable-object) (also Union)
Also encountering this with the Union type in Python 3.9: https://github.com/dkmiller/pyconfigurable...
11
pylint pylint exceed maximum recursion depth
I'm also seeing the behavior with pylint==2.6.0 & astroid==2.4.2. There are similar errors in bugtra...
423
ipython Last jedi release (0.18.0) is incompatible with ipython (7.19 and 7.18 tested); reason - column arg was deprecated, and now removed
As a temporary fix for anyone just trying to get things working again: It would be really nice if yo...
347
notebook execution error: doesn’t understand the “open location” message. (-1708)
(Solution at bottom!) So it seems that the problem is in the Python standard library ...
325
notebook juipiter notebook server "connecting to kernel" problem
Downgrading tornado to 4.5.3 fixed my problem with pip - sudo python3.6 -m pip install tornado==4.5....
275
notebook Kernal Error - FileNotFoundError: [WinError 2] The system cannot find the file specified
For anyone interested I found the solution: Open your Anaconda Prompt When I create a new env in Ana...
264
tqdm Jupyterlab and tqdm_notebook
I confirm this problem on my environment but it is upstream so IMHO nothing can be done on tqdm Plea...
202
ipython NameError: name 'sys' is not defined
Ok that was easy The Jedi release on 12/25 version 0.18.0 is breaking tab completion pip install --u...
158
notebook Cannot start jupyter notebook, DLL load failed
UPDATE w/ FIX: I fixed this problem by adding *anaconda root*/Library/bin to my PATH ...
143
scipy Unable to find imresize
I got this error even with pillow installed on scipy==1.3.0 I fixed it by installing an earlier vers...
134
notebook how to close running jupyter notebook servers?
Each server should start on a new port jupyter notebook list is reading a set of data files - each n...
130
notebook Installed package won't import in notebook
Check sys.executable and sys.path inside the notebook - I bet your kernel is not running in the envi...
107
notebook Crash when running jupyter notebook with a user with id != 1000
I had the same problem export XDG_RUNTIME_DIR= eliminated the problem. Apparently ...
85
notebook Kernel error win32api
Rumors abound there's an installation glitch in the 225 build of pywin32 Have you tried conda instal...
69
spyder Spyder Won't Launch
Could you run in a terminal and try again? Description of your problem What steps will reproduce the...
64
scipy Unable to install scipy on macOS Big Sur (Intel hardware)
Wow this worked Thank you: Install openblas: I used pip3 to install scipy Success!!!! ...
56
notebook Images in Markdown not showing when uploaded to Github
I spent some time figuring out what the problem with my image was I have used the below syntax to di...
53
ipython No module named shutil_get_terminal_size
Looks like you've installed IPython without getting its dependencies somehow Given that I see eggs ...
53
spyder [warn] kq_init: detected broken kqueue
Could you run in a terminal and try again? Description of your problem What steps will reproduce the...
52
spyder Mac OS spyder won't launch: python.app directory mismatch
Please run to see if that helps. Problem Description Spyder won't launch ...
49
spyder Spyder crashes with segmentation fault on startup in Anaconda 4.5.0
Following a suggestion in #3326 I was able to work around the problem by doing This problem is also ...
47
notebook Jupyter notebook does not launch
Can you get an Anaconda command prompt and run jupyter notebook in it? It probably won't work but yo...
47
tqdm How to update single progress bar in multiprocessing map()
from https://stackoverflow.com/questions/41920124/multiprocessing-use-tqdm-to-display-a-progress-bar...
45
spyder qtpy.PythonQtError: No Qt bindings could be found
You need to install PyQt4 or PyQt5 because that's not installed automatically by pip For PyQt5 just ...
44
spyder “RuntimeError: This event loop is already running”; debugging aiohttp, asyncio and IDE “spyder3” in python 3.6.5
I got the issue resolved by using the nest_async pip install nest_asyncio and adding below lines in ...
38
notebook "not implemented" message with jupyter notebook under python-3.8.0a4 (due to switch to "proactor" loop on windows)
workaround from https://stackoverflow.com/a/58430041: add this to tornado/platform/asyncio.py after ...
36
notebook Kernel error in jupyter notebook
Try conda install pywin32 if you are using conda. ...
35
notebook Notebook suddenly started to ask for a password?
hello I have problems because jupyter notebook list doesn't show token :/ Can anyone help me with th...
32
notebook Autocomplete not working
This is a different issue It's essentially this issue: ipython/ipython#12740 As a temporary solution...
31
ipython ImportError: No module named shutil_get_terminal_size
@oschow this should work in general: Update from @Carreau : Reopening tagging 5.4 we should vendor s...
30
notebook how to read dataset from local computer file in jupyter notebook
Hi that is the right way to use pandas but it looks like you're using a relative path -- the ../ to ...
27
notebook Opera browser: Access to the file was denied after starting
I followed the following steps: I created the configuration file: jupyter notebook --generate-config...
26
scipy Not able to install scipy using pip in docker alpine image with python:3.5.6-alpine image
#Apologies for the delayed response As @rgommers stated scipy doesn't maintain a docker image rather...
26
spyder Getting "Spyder already running" warning when it's not
You need to look for a directory called .spyder2 in your Users\<your account> directory the find a f...
25
spyder Autocomplete is not working
@hepinjing could you remove enum and try again? Description In the last version of Anaconda 3 ...
25
spyder Spyder doesn't start - no module named 'PyQt5.QtWebEngineWidgets'
Actually you need to uninstall it first: pip uninstall pyqtwebengine pip install pyqtwebengine This ...
23
spyder Segmentation fault (core dumped) when trying to start conda-installed spyder 3.2.8
@addyblue Try conda install pyopengl Developer Note: *This issue is now resolved in Spyder >=3.3.0 T...
22
ipython pip install error
That's unrelated to IPython the issue comes from installing scandir you should see that with the sca...
22
notebook (zmqhandlers.py) RuntimeWarning: coroutine 'WebSocketHandler.get' was never awaited
I got my notebook to connect by downgrading tornado from 6.0.0 to 5.1.1: Attempting to connect to a ...
20
notebook Markdown table alignment
It's one thing enforce right-alignment for consistency reasons as described in /pull/2534 ...
20
notebook NotImplemented Error Jupyter Notebook
Fixed by adding this code in python38/Lib/site-packages/tornado/platorm/asyncio.py after the main me...
17
scipy Bug in L-BFGS-B minimize?
In fact if I start playing the guessing game Hi I think I found a bug Good news is that I think I kn...
15
notebook Jupyter Notebook won't start due to ports being already in use
On the system that it's running on jupyter notebook stop 8888 should work. Fresh install of anaconda...
14
notebook jupyter - Failed to start the kernel
I'd guess that you created the kernelspec for an environment which you've now deleted or removed ...
14
notebook Unable to create jupyter notebook
Then it looks like rm /home/ubuntu/.local/share/jupyter && mkdir /home/ubuntu/.local/share/jupyter s...
14
spyder spyder 3.2.8 crashes on launch with (clean conda install of) Python 3.6.5 on MacOS 10.12.6
The real solution is to run in Terminal.app Problem Description spyder on MacOS 10.12.6 with Python ...