Closed ix5 closed 3 years ago
There are few things that are not working with SQLAlchemy 1.4:
sqlalchemy-utils is not compatible:
File "/home/travis/build/flask-admin/flask-admin/.tox/py37-WTForms2/lib/python3.7/site-packages/sqlalchemy_utils/functions/orm.py", line 14, in
More here: https://github.com/kvesteri/sqlalchemy-utils/issues/505
I'm checking what's going with the is_hybrid_property
. There was a suggested change from the SQLAlchemy author - will see if it helps.
I tried to reproduce the M2M issue with the latest SQLAlchemy 1.4.2 and it works as expected with and without back_populates.
Here's a GIST: https://gist.github.com/mrjoes/30cf8cd7865484ade357e966ad82439d
sqlalchemy-utils is still a problem, our tests are failing.
Sorry, reproduction was missing a crucial bit: column_searchable_list
is where it fails to resolve.
See gist: app.py
Does not reproduce even if I add column_searchable_list
. Your gist does not start due to ValueError: urls must start with a leading slash
Just in case - this is latest master branch.
I did not run master branch, but rather this constellation:
Flask-Admin 1.5.7
Flask-SQLAlchemy 2.5.1
SQLAlchemy 1.4.2
(flask-admin 1.5.7 is the latest in pypi)
If the master branch indeed fixes the issue, a new release should be made.
is_hybrid_property
has been fixed recently in #2098
Guess this fixes it then.
If this is not the intention, consider if these relationships should be linked with back_populates, flask sqlalchemy
users = db.relationship('User', secondary=association_table,back_populates="events")
Take the following model:
This will throw an error on SQLALchemy 1.4.x
Adding
back_populates
or backrefs as suggested by the error message and as documented in Basic Relationship Patterns like this:results in a new error:
The call to
inspect()
fails atis_hybrid_property()
for the attr_nametags.name
Link to gist for reproducing: app.py
Library versions:
Possibly related:
sqlalchemy_utils
uses aget_mapper
func to resolve object instead of blindly callinginspect