You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use concrete inheritance with flask-sqlalchemy but can't seem to get it to work. I've seen similar issues as the ones reportedly fixed by #541. At this point I'm not sure what else to try.
sqlalchemy.exc.InvalidRequestError: When initializing mapper Mapper|List|lists, expression 'ListItem' failed to locate a name ("name 'ListItem' is not defined"). If this is a class name, consider adding this relationship() to the <class 'models.List'> class after both dependent classes have been defined.
when trying to run l = List().
Thoughts?
The text was updated successfully, but these errors were encountered:
I am not familiar with concrete inheritance. As stated in #248, I did not attempt to support it because there were no existing tests for it and no one had requested it in the past. Are you sure this is because of Flask-SQLAlchemy and not your code? Does it work in plain SQLAlchemy?
If you need this, I'm happy to review a patch, but I will not be actively working on it. The simple solution if it's really related to tablename generation is to set the tablenames manually, as you would have to in plain SQLAlchemy.
@davidism Hi there! Thanks for the quick reply - I managed to reproduce some part of the issue in raw SQLalchemy. Looks like there's some weird internal state that only gets set after CompanyItemList is instantiated at least once.
I'll take this issue over to SQLa and close the issue here.
I'm trying to use concrete inheritance with flask-sqlalchemy but can't seem to get it to work. I've seen similar issues as the ones reportedly fixed by #541. At this point I'm not sure what else to try.
I uploaded my code to https://github.com/halfdan/flask-sqla-concrete-inheritance/blob/master/models.py
I'm essentially trying to get to a point where I can call
db.session.query(ListItem)
and get both CompanyListItems and GeoListItems properly loaded. This is documented here: https://docs.sqlalchemy.org/en/latest/orm/extensions/declarative/api.html#sqlalchemy.ext.declarative.AbstractConcreteBaseWith the current code I'm getting
when trying to run
l = List()
.Thoughts?
The text was updated successfully, but these errors were encountered: