You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用pangres 4.1.2与SQLAlchemy 2.0.36时出现ImportError:无法从sqlalchemy.engine.base导入Connectable

pangres 4.1.2与SQLAlchemy 2.0.36时出现ImportError:无法从sqlalchemy.engine.base导入Connectable

Hey there! That ImportError is popping up because pangres 4.1.2 isn't compatible with SQLAlchemy 2.0.36.

SQLAlchemy 2.0 introduced some breaking changes to its internal structure—specifically, it moved the Connectable class from sqlalchemy.engine.base to sqlalchemy.engine. Since pangres 4.1.2 was built to work with older SQLAlchemy versions (pre-2.0), it's still trying to pull Connectable from the old spot, which doesn't exist anymore.

You’ve got two easy fixes to choose from:

  • Option 1: Upgrade pangres to a version that supports SQLAlchemy 2.0
    Versions of pangres starting from 5.0.0 and up are fully compatible with SQLAlchemy 2.0. Just run this command to upgrade:

    pip install --upgrade pangres>=5.0.0
    
  • Option 2: Downgrade SQLAlchemy to a compatible 1.x version
    If you can’t or don’t want to upgrade pangres, you can roll back SQLAlchemy to a 1.4.x release (the last version series before 2.0 that works with pangres 4.1.2). Use this command:

    pip install sqlalchemy<2.0
    

Pick whichever option fits your project’s needs, and that should get rid of the error so your script can run properly.

备注:内容来源于stack exchange,提问作者John Langford

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 14:29:52