Unsymmetric inherit_condition

Issue #1039 resolved
Former user created an issue

I use polymorphic inheritance and have use inherit_condition's. In inherit_condition mapper parameter table_a.c.column_a==table_b.c.collumn_b is not the same as table_b.c.column_b==table_a.c._column_a.

It seems that the course is unsymmetric conditions in orm.mapper:

    def _deferred_inheritance_condition(self, base_mapper, needs_tables):
        base_mapper = base_mapper.primary_mapper()

        def visit_binary(binary):
            leftcol = binary.left
            rightcol = binary.right
            if leftcol is None or rightcol is None:
                return
            if leftcol.table not in needs_tables:
                binary.left = sql.bindparam(None, None, type_=binary.right.type)
                param_names.append((leftcol, binary.left))
            elif rightcol not in needs_tables:
                binary.right = sql.bindparam(None, None, type_=binary.right.type)
                param_names.append((rightcol, binary.right))

Comments (3)

  1. Mike Bayer repo owner

    I'm sorry I don't understand the issue here. Can you please attach a fully working test case which illustrates the issue you're having; otherwise the ticket will have to be closed.

  2. Log in to comment