[sqlalchemy] Re: Polymorphic union of two sibling classes (no real inheritance)

2010-07-30 Thread Kent
Hopefully you've got time to read a compliment: this polymorphism is very cool (well, sqla in general). Great work! Kent On Jul 29, 5:41 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 29, 2010, at 5:00 PM, Kent Bower wrote: Right.  I understand.  Thanks for pointing that out, you

[sqlalchemy] Re: Polymorphic union of two sibling classes (no real inheritance)

2010-07-30 Thread Kent
I am having a problem when I'm specifying an order_by for a relationship entity's column when the relationship is this polymorphic_union. orders = DBSession.query(Order)\ .options(joinedload(Order.transactions))\ .filter(Order.customerid==customerid)\

Re: [sqlalchemy] Re: Polymorphic union of two sibling classes (no real inheritance)

2010-07-30 Thread Michael Bayer
On Jul 30, 2010, at 9:51 AM, Kent wrote: I am having a problem when I'm specifying an order_by for a relationship entity's column when the relationship is this polymorphic_union. orders = DBSession.query(Order)\ .options(joinedload(Order.transactions))\

[sqlalchemy] Re: Polymorphic union of two sibling classes (no real inheritance)

2010-07-29 Thread Kent
This seems to work, but I didn't find examples of this. Does this look correct (assuming there is no parent table in the database and all I really want is 2 'normal' mappers and a 3rd that performs a polymorphoric_union)? == artran_union =

Re: [sqlalchemy] Re: Polymorphic union of two sibling classes (no real inheritance)

2010-07-29 Thread Michael Bayer
What I meant was, if you want to say session.query(ArTranBase), which it appears that you do, then you are querying against ArTranBase. Since it seems like you want the polymorphic_union here, when you query ArTranBase and you want it to eagerly load trancode and paymenttype, it would need

Re: [sqlalchemy] Re: Polymorphic union of two sibling classes (no real inheritance)

2010-07-29 Thread Kent Bower
Right. I understand. Thanks for pointing that out, you are correct. My bigger concern was getting the ArTranBase mapper correct. Apparently there is no need in this case to specify with_polymorphic= in the mapper. Did I miss documentation on using 'polymorphic_union' without

Re: [sqlalchemy] Re: Polymorphic union of two sibling classes (no real inheritance)

2010-07-29 Thread Michael Bayer
On Jul 29, 2010, at 5:00 PM, Kent Bower wrote: Right. I understand. Thanks for pointing that out, you are correct. My bigger concern was getting the ArTranBase mapper correct. Apparently there is no need in this case to specify with_polymorphic= in the mapper. Did I miss