Re: [sqlalchemy] Problems with synonym property using a mixin class

2010-07-24 Thread Michael Bayer
On Jul 24, 2010, at 5:40 PM, Nikolaj wrote: > I'm having trouble inheriting a synonym property from a mixin class. > It obviously works if the call to synonym() is on the child class and > just the get/set methods are left on the mixin. Here is an example: > > > from sqlalchemy import create_en

[sqlalchemy] Cascading delete down through in directed graph

2010-07-24 Thread troutwine
Hello all, I've made some modifications to the directed graph[1] example, of primary interest to this email being the introduction Manufacturer objects which act as owners of Nodes. My desire is to cascade the deletion of a Manufacturer down to every Node and Edge, even if the side of one Edge is

[sqlalchemy] Problems with synonym property using a mixin class

2010-07-24 Thread Nikolaj
I'm having trouble inheriting a synonym property from a mixin class. It obviously works if the call to synonym() is on the child class and just the get/set methods are left on the mixin. Here is an example: from sqlalchemy import create_engine, Column, ForeignKey from sqlalchemy.ext.declarative i

Re: [sqlalchemy] Re: session get last row id?

2010-07-24 Thread Lance Edgar
On Sat, 2010-07-24 at 08:06 -0700, manman wrote: > new_a=A() > session.begin() > session.add(new_a) > session.flush() > new_b=B() > new_b.a_id=new_a.id > session.add(new_b) > > try: > session.commit() > except: > session.rollback() > raise > > this code is right? when error all be rollback

[sqlalchemy] Re: session get last row id?

2010-07-24 Thread manman
new_a=A() session.begin() session.add(new_a) session.flush() new_b=B() new_b.a_id=new_a.id session.add(new_b) try: session.commit() except: session.rollback() raise this code is right? when error all be rollback? -- You received this message because you are subscribed to the Google Groups

Re: [sqlalchemy] Re: session get last row id?

2010-07-24 Thread Alexandre Conrad
"flush" is not "commit". After a flush, you can still rollback. 2010/7/24 manman > if use flush() then how to rollback ? > > -- > 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. >

[sqlalchemy] Re: session get last row id?

2010-07-24 Thread manman
if use flush() then how to rollback ? -- 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 mor

Re: [sqlalchemy] Re: session get last row id?

2010-07-24 Thread Lance Edgar
On Sat, 2010-07-24 at 07:06 -0700, manman wrote: > thanks. > > if not use "relation" then how to do? i hate use ForeignKey or > ManyToMany. > So did the explicit call to session.flush() not work? Here it is again for reference: new_a = A() session.begin() session.add(new_a) session.flush()

[sqlalchemy] Re: session get last row id?

2010-07-24 Thread manman
thanks. if not use "relation" then how to do? i hate use ForeignKey or ManyToMany. -- 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 sq

[sqlalchemy] Re: sqlalchemy and desktop apps

2010-07-24 Thread Joel Mohler
gbtami, Thanks! > pypapi.org is the bigest example a know. > It's using pyqt4, sqlalchemy and zope interfaces/schema/etc. > The only drawback for me, the code using too much italiano :) Indeed, too Italiano for me too, but the picture at http://www.pypapi.org/chrome/site/pypapi.gif is worth a 100

Re: [sqlalchemy] optimistic concurrency and relationships

2010-07-24 Thread Michael Bayer
On Jul 24, 2010, at 2:33 AM, avdd wrote: > I rely heavily on the version_id_col feature and I would like to be > able to either explicitly increment the version, or have the version > incremented when a relationship changes. The issue here is that a > change in a relationship is a semantic chang

Re: [sqlalchemy] session get last row id?

2010-07-24 Thread Lance Edgar
On 7/24/2010 8:21 AM, manman wrote: table A,B B.a_id=A.id my code like this: new_a=A() session.begin() session.add(new_a) new_b=B() new_b.a_id=new_a.id session.add(new_b) try: session.commit() except: session.rollback() raise why new_b.a_id is None? how to do? I presume a.id is

[sqlalchemy] session get last row id?

2010-07-24 Thread manman
table A,B B.a_id=A.id my code like this: new_a=A() session.begin() session.add(new_a) new_b=B() new_b.a_id=new_a.id session.add(new_b) try: session.commit() except: session.rollback() raise why new_b.a_id is None? how to do? -- You received this message because you are subscribed to the

Re: [sqlalchemy] sqlalchemy and desktop apps

2010-07-24 Thread Tamás Bajusz
Hi Joel! pypapi.org is the bigest example a know. It's using pyqt4, sqlalchemy and zope interfaces/schema/etc. The only drawback for me, the code using too much italiano :) Regards, gbtami On Sat, Jul 24, 2010 at 3:21 AM, Joel Mohler wrote: > Hello, > > I'm a happy user of sqlalchemy on small p