“SQLAlchemy"的实例没有“列"成员(无成员) [英] Instance of 'SQLAlchemy' has no 'Column' member (no-member)

查看:24
本文介绍了“SQLAlchemy"的实例没有“列"成员(无成员)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试实现网站的 Steam 登录.但是我无法在代码中传递这个错误.我已经创建了数据库对象,但它一直显示我之前提到的错误.我不确定 SQLAlchemy 是否发生了变化,或者自从我使用它之后发生了什么变化.

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)

pylint 发出的消息是

E1101: Instance of 'SQLAlchemy' has no 'Column' member (no-member)

推荐答案

EDIT:阅读并尝试 np8 的回答 我之前的回答是错误的,你必须安装一个包,它是 pylint_flask_sqlalchemy

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

所以答案是

在你的项目目录中找到文件夹.vscode(如果你没有它,只需创建它)然后创建文件settings.json并添加这一行

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
    ]
}

您还需要有 pylint-flask-sqlalchemy 并且如果您想使用 <在您当前的 python 环境中安装一个 href="https://github.com/jschaf/pylint-flask" rel="nofollow noreferrer">pylint-flask:

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

这篇关于“SQLAlchemy"的实例没有“列"成员(无成员)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆