-
Notifications
You must be signed in to change notification settings - Fork 170
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
Handling of lazy="dynamic"
relationships
#388
Comments
I see this other issue explains this might not be handled soon, maybe this could be added to docs? maybe the workaround shown here can also be helpful for others 🤷 |
Hey @jarojasm95 , |
@aminalaee thanks for the quick reply! I'd be open to putting up that PR if that sounds good to you |
Yes, that would be great. |
Bumping. Have this been adressed? I seem to have the same issue. All relations are loaded from database regardless if they are displayed in list view or not. |
Checklist
master
.Describe the bug
Model relations are automatically loaded regardless of the
ModelView
configuration, this causes issues with relationships defined aslazy="dynamic"
because it ends up inInvalidRequestError( '%s' does not support object population - eager loading cannot be applied.)
from sqlalchemy. The error is raised on anylist
ordetail
request.The current workaround I'm applying is:
Steps to reproduce the bug
Setting up two SQLAlchemy Models and configuring a relationship between them with the
lazy="dynamic"
parameter should sufficeExpected behavior
column_list
orcolumn_details_list
are not eagerly loadedlazy="dynamic"
are either ignored (short term fix?) or correctly handled (longer term feature?)Actual behavior
InvalidRequestError
causes theModelView
to be unusable for models withlazy="dynamic"
relationshipsDebugging material
Starlette Debugger.pdf
Environment
Additional context
No response
The text was updated successfully, but these errors were encountered: