On Jul 31, 2010, at 7:41 AM, Kent wrote:

> I'm having a problem trying to merge() an object for which I have
> setup a polymorphic_union:
> 
> artran_union = polymorphic_union({
>        'artran': artrans_table,
>        'archive': artransarchive_table
>    }, 'type', 'artran_union')
> 
> artranbase_mapper = mapper(ArTranBase, artran_union,
>    polymorphic_on=artran_union.c.type,
>    properties={'trancode': relation(TranCode,
>                    cascade='refresh-expire,expunge', lazy=False),
>                'paymenttype': relation(PaymentType,
>                    cascade='refresh-expire,expunge', lazy=False)}
>    )
> 
> 
> # ----------- ArTran
> mapper(ArTran, artrans_table, inherits=artranbase_mapper,
>    concrete=True, polymorphic_identity='artran',
>    properties={'trancode': relation(TranCode,
>                    cascade='refresh-expire,expunge', lazy=False),
>                'paymenttype': relation(PaymentType,
>                    cascade='refresh-expire,expunge', lazy=False)}
>    )
> 
> 
> # --------- ArTranArchive
> mapper(ArTranArchive, artransarchive_table,
> inherits=artranbase_mapper,
>    concrete=True, polymorphic_identity='archive',
>    properties={'trancode': relation(TranCode,
>                    cascade='refresh-expire,expunge', lazy=False),
>                'paymenttype': relation(PaymentType,
>                    cascade='refresh-expire,expunge', lazy=False)}
>    )
> 
> 
> When I call merge() on an ArTran object, the merge() method of a
> ConcreteInheritedProperty 'artransarchiveid'
> that *exists only on ArTranArchive* is being called.

well its going to call upon the properties of ArTranBase, I gather you've used 
pdb and such to figure out that "ArTranArchive" is the direct parent of the 
property ?  All three classes have relationships of the same names.

> 
> Have I set something up incorrectly or is this a bug?

its likely there's no test coverage for concrete (a use case I try to 
discourage people from using) + relationships on concrete (which was totally 
unsupported until very recently) + merge.

> 
> (
> As an aside, instead of getting a 'NotImplementedError' when
> ConcreteInheritedProperty.merge() is called, I am getting "TypeError:
> merge() takes exactly 6 arguments (8 given)"

hence the deduction that there's no test coverage for this case.


> I think you need to update the MapperProperty interface's merge()
> definition from
> "def merge(self, session, source, dest, load, _recursive):"
> ->
> "def merge(self, session, source_state, source_dict, dest_state,
> dest_dict, load, _recursive):"
> )
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to