1

When I rebuilt a Docker image for my Python application that uses SQLAlchemy and Alembic, I started getting the following error when running migrations:

ImportError: cannot import name '_NONE_NAME' from 'sqlalchemy.sql.naming'

I didn't change my pinned requirements in requirements.txt. What is causing the issue?

davidism
  • 121,510
  • 29
  • 395
  • 339

2 Answers2

2

Upgrading to Alembic >= 1.10.2 resolves this, it fixed compatibility with SQLAlchemy < 1.3.24.

https://github.com/sqlalchemy/alembic/releases/tag/rel_1_10_2

davidism
  • 121,510
  • 29
  • 395
  • 339
0

I had this same problem since yesterday.

Reproducing the problem locally: I noticed that creating a new venv and reinstalling the requirements reproduced the problem like in the container.

Diagnosis: So, I created a new venv and reinstalled the requirements.txt. Then i did pip freeze and compared the new installations to the pip freeze running on the old venv that was still working locally. I found that alembic was installed witha different versions.

My solution: I downgraded alembic to be alembi==1.8.1 and now it works.

Hope this helps!

Simba
  • 101
  • 2