Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No module named 'sqlalchemy.ext.declarative.clsregistry' on version 1.4.0 #6065

Closed
rika opened this issue Mar 16, 2021 · 11 comments
Closed

No module named 'sqlalchemy.ext.declarative.clsregistry' on version 1.4.0 #6065

rika opened this issue Mar 16, 2021 · 11 comments
Labels
question issue where a "fix" on the SQLAlchemy side is unlikely, hence more of a usage question third party integration issues issues to do with other libraries and frameworks

Comments

@rika
Copy link

rika commented Mar 16, 2021

Describe the bug
The newer version of SQLAlchemy breaks due to sqlalchemy.ext.declarative.clsregistry module not being found.

Expected behavior
The module should be found.

To Reproduce
Install the newer version of the lib:

python3 -m pip install SQLAlchemy==1.4.0

On python, import the module:

import sqlalchemy.ext.declarative.clsregistry

Error

ModuleNotFoundError: No module named 'sqlalchemy.ext.declarative.clsregistry'

Versions.

  • OS: Ubuntu 18.04.5 LTS
  • Python: 3.6.9
  • SQLAlchemy: 1.4.0
@rika rika added the requires triage New issue that requires categorization label Mar 16, 2021
@rika rika changed the title No module named 'sqlalchemy.ext.declarative.clsregistry' No module named 'sqlalchemy.ext.declarative.clsregistry' on version 1.4.0 Mar 16, 2021
@zzzeek zzzeek added question issue where a "fix" on the SQLAlchemy side is unlikely, hence more of a usage question and removed requires triage New issue that requires categorization labels Mar 16, 2021
@zzzeek
Copy link
Member

zzzeek commented Mar 16, 2021

hey there -

"clsregistry" was not really meant for public consumption, is there a reason you need to import this?

@zzzeek
Copy link
Member

zzzeek commented Mar 16, 2021

also it's present in "sqlalchemy.orm.clsregistry" now.

@rika
Copy link
Author

rika commented Mar 16, 2021

Hello!
Today, it broke Spark submission tasks on an Airflow setup I work with.

I found the following trackeback:

  File "/usr/local/bin/airflow", line 26, in <module>
    from airflow.bin.cli import CLIFactory
  File "/usr/local/lib/python3.7/dist-packages/airflow/bin/cli.py", line 80, in <module>
    from airflow.www.app import (cached_app, create_app)
  File "/usr/local/lib/python3.7/dist-packages/airflow/www/app.py", line 38, in <module>
    from airflow.www.blueprints import routes
  File "/usr/local/lib/python3.7/dist-packages/airflow/www/blueprints.py", line 25, in <module>
    from airflow.www import utils as wwwutils
  File "/usr/local/lib/python3.7/dist-packages/airflow/www/utils.py", line 40, in <module>
    import flask_admin.contrib.sqla.filters as sqlafilters
  File "/usr/local/lib/python3.7/dist-packages/flask_admin/contrib/sqla/__init__.py", line 2, in <module>
    from .view import ModelView
  File "/usr/local/lib/python3.7/dist-packages/flask_admin/contrib/sqla/view.py", line 18, in <module>
    from flask_admin.contrib.sqla.tools import is_relationship
  File "/usr/local/lib/python3.7/dist-packages/flask_admin/contrib/sqla/tools.py", line 4, in <module>
    from sqlalchemy.ext.declarative.clsregistry import _class_resolver
ModuleNotFoundError: No module named 'sqlalchemy.ext.declarative.clsregistry'

When debugging the problem I came across the SQLAlchemy version update.
For the bug report, I tested on a simple terminal.

@ccage-simp
Copy link

ccage-simp commented Mar 16, 2021

Same for us yesterday for airflow.

Decided to revert to 1.3.23 until we could figure out root cause.

@CaselIT
Copy link
Member

CaselIT commented Mar 16, 2021

note that sqlalchemy does not follow semver, so 1.3 -> 1.4 is a major release :)

@ccage-simp
Copy link

Perhaps it is flask_admin will need an update for 1.4 compatibility.

@CaselIT
Copy link
Member

CaselIT commented Mar 16, 2021

from that stracktrace it seems so

@CaselIT CaselIT added the third party integration issues issues to do with other libraries and frameworks label Mar 16, 2021
@zzzeek
Copy link
Member

zzzeek commented Mar 16, 2021

they are accessing private API so this is on them:

File "/usr/local/lib/python3.7/dist-packages/flask_admin/contrib/sqla/tools.py", line 4, in
from sqlalchemy.ext.declarative.clsregistry import _class_resolver

@zzzeek
Copy link
Member

zzzeek commented Mar 16, 2021

see pallets-eco/flask-sqlalchemy#910

@ccage-simp
Copy link

Thank you. Defly seems like not a defect here.

@zzzeek
Copy link
Member

zzzeek commented Mar 16, 2021

can someone open an issue in flask-admin for me, for this as well as someone reported to me an import error from their example (this is more private API stuff):

in the latest version there is a small error in connection with flask-admin. 
ImportError: cannot import name '_ColumnEntity' from 'sqlalchemy.orm.query'.
With version 1.3.23 it still works.
 
https://github.com/flask-admin/flask-admin/tree/master/examples/sqla
 
python examples/sqla/run_server.py Throws the exception 
 

sorry for dumping I'm on like 18 emails today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question issue where a "fix" on the SQLAlchemy side is unlikely, hence more of a usage question third party integration issues issues to do with other libraries and frameworks
Projects
None yet
Development

No branches or pull requests

4 participants