pythonsqlalchemy

Error cannot import name 'Connectable' from 'sqlalchemy.engine.base' with pangres 4.1.2 and sqlalchemy 2.0.36


When I try to run my Python 3.9 script, I get the following error:

  File "/usr/local/lib/python3.9/site-packages/pangres/__init__.py", line 1, in <module>
from pangres.core import aupsert, upsert
  File "/usr/local/lib/python3.9/site-packages/pangres/core.py", line 9, in <module>
from sqlalchemy.engine.base import Connectable
  ImportError: cannot import name 'Connectable' from 'sqlalchemy.engine.base' (/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py)

I am using pangres 4.1.2 and sqlalchemy 2.0.36.


Solution

  • It turns out I was using an incompatible version of pangres. After upgrading to pangres version 4.2.1, this error was fixed.