Re: [sqlalchemy] calling begin nested on after_flush event

2012-08-30 Thread Michael Bayer
begin_nested() can be used within any of the before_flush(), after_flush(), or after_flush_postexec() methods, see below. What you can't do in *any* of these methods is flush() the Session itself, as the Session is already in the flush state and it does not support reentrant behavior.

[sqlalchemy] How-to : update A also create an update of B

2012-08-30 Thread Tony Moutaux
Hi there ! I'm going mad looking for a solution for what seems a simple problem. When object A is updated, I also want object B to be updated, using some computation based on A new values. From now, I can detect when A is modified using after_update. What I try is to look at event

[sqlalchemy] Re: How-to : update A also create an update of B

2012-08-30 Thread Tony Moutaux
A friend point me out the hybrid_property and the fact I can detect an update of A fields before doing the commit, issuing some update for B. I'll try this idea. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web

Re: [sqlalchemy] How-to : update A also create an update of B

2012-08-30 Thread Michael Bayer
On Aug 30, 2012, at 10:32 AM, Tony Moutaux wrote: Hi there ! I'm going mad looking for a solution for what seems a simple problem. When object A is updated, I also want object B to be updated, using some computation based on A new values. From now, I can detect when A is modified using

Re: [sqlalchemy] How-to : update A also create an update of B

2012-08-30 Thread Tony Moutaux
Only if some computation based on A new values means that there are SQL-level functions which you need to get at, does the rationale for after_update/after_flush events to come up.Unfortunately you can't emit a flush() within any of these events, as they are already local to the

Re: [sqlalchemy] How-to : update A also create an update of B

2012-08-30 Thread Michael Bayer
On Aug 30, 2012, at 11:12 AM, Tony Moutaux wrote: 2.if some computation involves SQL functions: a. emit your modifications to B using only SQL statements and Session.execute(), not by adding any new state to the Session or re-flushing. b. pre-execute your SQL functions for A

[sqlalchemy] SQLAlchemy Consultant needed

2012-08-30 Thread Dan Cardamore
Hello, We (QNX Software Systems) have an embedded project developed using SQLAlchemy and using sqlite3 and the database. It works, but needs an expert hand at tuning, debugging, and optimizing. Looking for someone to start ASAP. Please send your resume or qualifications to me @

[sqlalchemy] Re: SQLAlchemy column_property

2012-08-30 Thread Hong Minhee
You could use hybrid attributes to do that. http://docs.sqlalchemy.org/en/rel_0_7/orm/extensions/hybrid.html On Wednesday, August 29, 2012 5:22:02 PM UTC+9, Denis Rykov wrote: I have two models: class Report(Base): __tablename__ = 'report' id = Column(Integer,