PyCharm SQLAlchemy autocomplete

情到浓时终转凉″ 提交于 2019-12-04 07:32:25

The solution I've found to this (picked up from somewhere on the web) was to type hint the DBSession instance like this:

DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
""":type: sqlalchemy.orm.Session"""

After this the code completion seems to work fine everywhere in the project

Note that the tutorial states:

This guide was written for PyCharm 2.7.3, although many of the topics apply for PyCharm 3.

In PyCharm 3 Professional, it is much easier to install Pyramid and start using a scaffold. See one of my video tutorials Pyramid in PyCharm in 5 minutes at 1:17 specifically.

Also you might want to blow away your project and start fresh if stuff doesn't work as expected.

PyCharm 3 Professional supports SQAlchemy as follows.

  • Code insight (2.6+)
  • Possibility to view database structure in a diagram. Refer to the section Working with Diagrams.
  • Code completion and resolve. (3.0+)

See more information on how to use code completion.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!