unresolved attribute “Column” in class “SQLAlchemy”

后端 未结 2 784
执念已碎
执念已碎 2021-01-11 17:25

i use pycharm 5.0 and python3.5.And i download all the liarbry by the build-in function of pycharm(setting-project-project interpreter-\"+\").other libraries appear well,but

2条回答
  •  时光说笑
    2021-01-11 17:49

    The constructor of the flask_sqlalchemy.SQLAlchemy class calls _include_sqlalchemy, which attaches all attributes from sqlalchemy and sqlalchemy.orm to its instances.

    This is only done at runtime and not detected by PyCharm's code inspection.

    It would require flask_sqlalchemy to use a more standard way of importing those attributes, like from sqlalchemy import *. But this would import the attributes into the flask_sqlalchemy module instead of each instance of SQLAlchemy and thus change the way they're accessed.

    I'm not a Python or SQLAlchemy expert and won't judge whether this is good design or not but you could open an issue on https://github.com/mitsuhiko/flask-sqlalchemy and discuss it there.

提交回复
热议问题