-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Make loader strategy error message more verbose #12401
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
base: main
Are you sure you want to change the base?
Conversation
80a6ff4 to
b15a462
Compare
Fixes: sqlalchemy#12398 this commit makes the error message on conflicting loader strategies more verbose to help with debugging
b15a462 to
41ebcaf
Compare
test/orm/test_deferred.py
Outdated
| r"Loader strategy replacement " | ||
| r"ORM Path\[Mapper\[Order\(orders\)\] -> Order.user_id\] " | ||
| r"is in conflict with existing strategy " | ||
| r"ORM Path\[Mapper\[Order\(orders\)\] -> Order.user_id\]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok this doesn't seem to add much value, since the two sides are the same.
@zzzeek do we have also a way of getting what option is used in each part of the path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought bringing in _LoadElement.strategy might add more value to this, but I realised that it is also equal in a lot of cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im not really sure, I haven't looked at this code in a long time. I do know it's vastly simpler code than it was in 1.4 and earlier
|
@zzzeek do you think we can find that information to use in the exception or it's not easily available? |
Signed-off-by: Jan Vollmer <jan@vllmr.dev>
Signed-off-by: Jan Vollmer <jan@vllmr.dev>
|
I have re-iterated on this PR and found a way to create a verbose representation of the LoadElement. My solution involves more than simply accessing attributes. Therefore, I placed the logic in the |
|
thanks they do look a bit more informative |
Fixes: #12398
This PR makes the error message on conflicting loader strategies more verbose to help with debugging
Description
I changed the omitted error messages and the tests covering it.
Checklist
This pull request is:
must include a complete example of the issue. one line code fixes without an
issue and demonstration will not be accepted.
Fixes: #<issue number>in the commit messageinclude a complete example of how the feature would look.
Fixes: #<issue number>in the commit messageHave a nice day!