Add existing strategy to conflicting strategies error message · Issue #12398 · sqlalchemy/sqlalchemy · GitHub
Skip to content

Add existing strategy to conflicting strategies error message #12398

Description

@jvllmr

Describe the use case

I just received the following error of in my project and have an improvement request similar to #10668
:

sqlalchemy.exc.InvalidRequestError: Loader strategies for ORM Path[Mapper[Cable(cable)] -> Cable.cablesides -> Mapper[CadCableSide(cad_cable_side)]] conflict

While this tells me that there is a conflict and that my temporary replacement in the query causes a conflict, I am left alone to find out what exactly is in conflict with my replacement. This can be especially bothersome in a project with many models with many relationships with different loading strategies.

Therefore I suggest to add the existing loading strategy to the error message.

Relevant code:

Databases / Backends / Drivers targeted

All

Example Use

New error message could be something like this:

f"Loader strategy replacement {replacement.path} is in conflict with existing strategy {existing.path}"

I would gladly create a PR for it myself like last time.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ormuse casenot really a feature or a bug; can be support for new DB features or user use cases not anticipated

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions