Re: [sqlalchemy] Query about exception being raised on violating uniqueness constraint

2013-01-08 Thread Michael Bayer
I'm not familiar with that codebase (though I know, its the openstack base, maybe I should be), so it's hard to say. The begin() method on Session is usually not used because the docs recommend the Session remain in autocommit=False mode, so I'd need to better understand the overarching

Re: [sqlalchemy] Strange behaviour while trying to swap related records, or am I doing it wrong?

2013-01-08 Thread Alexey Vihorev
Thanks for the detailed explanation and the workarounds, works nicely. 2013/1/8 Michael Bayer mike...@zzzcomputing.com assuming you can try 0.8 which provides inspect(), this will show what is happening: from sqlalchemy import inspect print p.children[2] = c2 print

Re: [sqlalchemy] How to handle 'sub-commits'?

2013-01-08 Thread Michael Bayer
On Jan 8, 2013, at 4:00 PM, Ken Lareau wrote: Given this and your previous comments, and after some conversations with a coworker, I decided to expose the 'engine' variable from the database library and create a context manager as so: @contextlib.contextmanager def

Re: [sqlalchemy] How to handle 'sub-commits'?

2013-01-08 Thread Ken Lareau
On Tue, Jan 8, 2013 at 2:16 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Jan 8, 2013, at 4:00 PM, Ken Lareau wrote: Given this and your previous comments, and after some conversations with a coworker, I decided to expose the 'engine' variable from the database library and create a

[sqlalchemy] events: Which attributes did change (after_commit)?

2013-01-08 Thread Felix Schwarz
Hi, my question is how/if I can detect which attributes were changed when I get the 'after_commit' event. (I think it isn't possible based on what I read in the docs but I'd like to be sure.) If not, which other event could I use? What I want to achieve: I want to update an external search index

[sqlalchemy] events: Which attributes did change (after_commit)?

2013-01-08 Thread Felix Schwarz
Hi, my question is how/if I can detect which attributes were changed when I get the 'after_commit' event. (I think it isn't possible based on what I read in the docs but I'd like to be sure.) If not, which other event could I use? What I want to achieve: I want to update an external search index

[sqlalchemy] Initiate re-numeration of related records using sqlalchemy.ext.orderinglist

2013-01-08 Thread Alexey Vihorev
Hi all! Apparently, a relation declared using sqlalchemy.ext.orderinglist does not track sorting: 1. class Parent(Base): . 2. name = Column(Text) 3. children = relationship('Child', backref='parent', 4. collection_class=ordering_list('position', 1), 5.