PyCharm warns about unexpected arguments for SQLAlchemy User model

nor*_*rey 6 python sqlalchemy pycharm flask-login

I'm working with Flask-SQLAlchemy in PyCharm. When I try to create instances of my User model by passing keyword arguments to the model, PyCharm highlights the arguments with an "Unexpected argument(s)" warning. When I create instances of other models, I don't get this warning. Why am I getting this error for my User model?

class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String, unique=True, nullable=False)

new_user = User(username="test")
Run Code Online (Sandbox Code Playgroud)

In the above example username="test" is highlighted as a warning.

PyCharm 中的警告

dav*_*ism 10

这是 PyCharm 中的错误,而不是您的代码。使用 mixins 时,PyCharm 无法将列名识别为参数。您可以通过单击标题旁边的大拇指按钮来表达您对该问题的兴趣。在此之前,除了禁用检查或忽略突出显示之外,您无法解决此问题。