Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
351 views
in Technique[技术] by (71.8m points)

python - Instance of 'SQLAlchemy' has no 'Column' member (no-member)

I'm currently trying to implement steam login into website. But I'm unable to get pass this error within the code. I've created the database object but it keeps showing the error I mentioned earlier. I'm not sure whether SQLAlchemy has changed or what since I used it.

from flask import Flask
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
db = SQLAlchemy(app)

class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)

The message emitted by pylint is

E1101: Instance of 'SQLAlchemy' has no 'Column' member (no-member)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

EDIT: After read and try np8's answer my previous answer is wrong there is a package you have to install, which is pylint_flask_sqlalchemy

so the answer will be

on your project directory find folder .vscode (if you dont have it, just create it) then create file settings.json and add this line

{
    # You have to put it in this order to make it works
    "python.linting.pylintArgs": [
        "--load-plugins",
        "pylint_flask_sqlalchemy",
        "pylint_flask",                 # This package is optional
    ]
}

You also need to have pylint-flask-sqlalchemy and if you want to use pylint-flask install on your current python environment:

pip install pylint-flask-sqlalchemy
pip install pylint-flask

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...