[Solved] ImportError: cannot import name ‘_ColumnEntity’ from ‘sqlalchemy.orm.query’

Hello Guys, How are you all? Hope You all Are Fine. When I was run superset upgrade db suddenly I got ImportError: cannot import name ‘_ColumnEntity’ from ‘sqlalchemy.orm.query’ this error. So Here I am Explain to you all the possible solution Here.

Without Wasting your time, Lets start This Article to Solve This Error in react-native.

How ImportError: cannot import name ‘_ColumnEntity’ from ‘sqlalchemy.orm.query’ Occurs ?

I Was Installed apache-superset in my environment and then I Run superset upgrade db command, But Suddenly I Got Below Error.

I run into the following error:

ImportError: cannot import name '_ColumnEntity' from 'sqlalchemy.orm.query' (/Users/admin/supersetenv/lib/python3.7/site-packages/sqlalchemy/orm/query.py)

How to solve ImportError: cannot import name ‘_ColumnEntity’ from ‘sqlalchemy.orm.query’ ?

Question: How to solve ImportError: cannot import name ‘_ColumnEntity’ from ‘sqlalchemy.orm.query’ ?
Answer: The Problem is sqlalchemy 1.4 shipped, so it is now the default that pip installs. There were many interface changes and a new query interface added. So When you upgrading 1.4 that will break stuff that depends on the sqlalchemy 1.3 API internals. So Solution is to downgrade sqlalchemy.

Solution 1

The Problem is sqlalchemy 1.4 shipped, so it is now the default that pip installs. There were many interface changes and a new query interface added.

So When you upgrading 1.4 that will break stuff that depends on the sqlalchemy 1.3 API internals. So Solution is to downgrade sqlalchemy.

Follow Below Command Line to downgrade version.

requirements.txt:

sqlalchemy < 1.4.0

Then use:

pip -r requirements.txt

to “downgrade” to the pinned version.

This Solution Worked for me.

Solution 2

  1. You Just want to add that a new release for Flask-AppBuilder was made that pins SQLAlchemy bellow 1.4.0.
  2. So installing apache-superset using pip install apache-superset should work now.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Leave a Comment

x