Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jvllmr
Copy link
Contributor

@jvllmr jvllmr commented Mar 5, 2025

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:

  • A documentation / typographical / small typing error fix
    • Good to go, no issue or tests are needed
  • A short code fix
    • please include the issue number, and create an issue if none exists, which
      must include a complete example of the issue. one line code fixes without an
      issue and demonstration will not be accepted.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests. one line code fixes without tests will not be accepted.
  • A new feature implementation
    • please include the issue number, and create an issue if none exists, which must
      include a complete example of how the feature would look.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests.

Have a nice day!

@jvllmr jvllmr force-pushed the strategy-conflict-more-verbose branch from 80a6ff4 to b15a462 Compare March 5, 2025 20:26
@jvllmr jvllmr requested a review from zzzeek March 5, 2025 20:28
Fixes: sqlalchemy#12398
this commit makes the error message on conflicting loader strategies more verbose to help with debugging
@jvllmr jvllmr force-pushed the strategy-conflict-more-verbose branch from b15a462 to 41ebcaf Compare March 5, 2025 20:49
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\]",
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add existing strategy to conflicting strategies error message
3 participants