master
.Model relations are automatically loaded regardless of the ModelView
configuration, this causes issues with relationships defined as lazy="dynamic"
because it ends up in InvalidRequestError( '%s' does not support object population - eager loading cannot be applied.)
from sqlalchemy. The error is raised on any list
or detail
request.
The current workaround I'm applying is:
class ModelView(ModelView):
def __init__(self) -> None:
super().__init__()
self._relations = [rel for rel in self._relations if rel.lazy != "dynamic"]
Setting up two SQLAlchemy Models and configuring a relationship between them with the lazy="dynamic"
parameter should suffice
column_list
or column_details_list
are not eagerly loadedlazy="dynamic"
are either ignored (short term fix?) or correctly handled (longer term feature?)InvalidRequestError
causes the ModelView
to be unusable for models with lazy="dynamic"
relationships
No response
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too