python连接postgresql数据库的时候报错:
sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgres.psycopg2
创建的engine:
engine = create_engine('postgres+psycopg2://user:123@10.10.10.20:5432/security')
报错原因:
URI应该以postgresql://
而不是postgres://
开头。SQLAlchemy过去接受这两个名称,但已删除对postgres名称的支持。
更改之后就可以正常原因