mapping to joins has various dupe column/pk issues

Issue #1896 resolved
Mike Bayer repo owner created an issue

attached patch has some notes on this

Comments (6)

  1. Mike Bayer reporter

    OK, I think with some cleanup, we can turn it into the equivalent this (the _allow_inserts flag and all has to be solidified):

    -                prop.columns.append(column)
    +                if prop.columns and not prop._allow_inserts:
    +                    raise sa_exc.InvalidRequestError("wont equate cols x and y without explicit")
    +                    
    +                prop.columns.insert(0, column)
    

    where the exception should be along the lines of, "won't implicitly append col Y to explicit column list for attribute X. Assign col Y to an attribute explicitly"

    that way no surprise happens at least when a column has been named explicitly. Because it actually is happening a lot in tests and I didn't even notice it myself. When a mapping to a join implicitly puts them together, not sure what we should be doing - in inheritance cases it seems correct.

  2. Mike Bayer reporter

    the most recent patch approaches the problem cleanly. Inheritance relationships can override a column exactly once. All other implicit overrides raise. Included is the capability for include_properties and exclude_properties to include columns. We can backport the include/exclude fix, as well as the error message as a warning only when cols are implicitly bundled, to 0.6.

  3. Log in to comment