[sqlalchemy] Re: Curious Problem

2009-09-02 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of gizli Sent: 02 September 2009 04:45 To: sqlalchemy Subject: [sqlalchemy] Curious Problem Hi all, I just discovered something weird when doing concurrency testing with my

[sqlalchemy] Re: declarative style many to many, possible fix

2009-09-02 Thread Michael Bayer
secondary requires a Table object as its argument. it is not recommended to create a relation that uses a mapped table as its secondary unless the relation specifies viewonly=True. Jae Kwon wrote: Is there a way to declaratively create many to many relationships where the 'secondary'

[sqlalchemy] Re: Curious Problem

2009-09-02 Thread Michael Bayer
gizli wrote: Hi all, I just discovered something weird when doing concurrency testing with my program. Before writing a simplified test case for it and really figuring out whether its a bug with sqlalchemy (I am using 0.5.5), I wanted to write the scenario here. Basically I was getting the

[sqlalchemy] Re: declarative style many to many, possible fix

2009-09-02 Thread Jae Kwon
Thanks for looking. What happens when viewonly=False? I tried appending/popping from the list of related secondary objects but I didn't see any duplicate inserts/deletes. - Jae On Sep 2, 2009, at 8:16 AM, Michael Bayer wrote: secondary requires a Table object as its argument. it is

[sqlalchemy] Re: union with two different orders

2009-09-02 Thread Michael Bayer
naktinis wrote: I tried calling .subquery() method on each union subquery like this: q1 = Thing.query().filter(...).order_by(Thing.a.desc()).limit (1).subquery() q2 = Thing.query().filter(...).order_by(Thing.a.asc()).limit (1).subquery() q = q1.union(q2).order_by(Thing.id) I know you're

[sqlalchemy] Re: declarative style many to many, possible fix

2009-09-02 Thread Michael Bayer
Jae Kwon wrote: Thanks for looking. What happens when viewonly=False? I tried appending/popping from the list of related secondary objects but I didn't see any duplicate inserts/deletes. if you create new entities on the secondary table, and also insert records in the relation() with the

[sqlalchemy] Re: union with two different orders

2009-09-02 Thread naktinis
On 2 Rugs, 20:41, Michael Bayer mike...@zzzcomputing.com wrote: naktinis wrote: I tried calling .subquery() method on each union subquery like this: q1 = Thing.query().filter(...).order_by(Thing.a.desc()).limit (1).subquery() q2 = Thing.query().filter(...).order_by(Thing.a.asc()).limit

[sqlalchemy] Re: declarative style many to many, possible fix

2009-09-02 Thread Jae Kwon
if you create new entities on the secondary table, and also insert records in the relation() with the secondary, it will persist them separately. I see that now. I have found myself using this pattern, however, since relation + secondary can create more efficient joins than an eagerload