> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> On Behalf Of bool
> Sent: 19 April 2011 14:16
> To: sqlalchemy
> Subject: [sqlalchemy] API that allows me to do additional database
> operations just before insert execution for SQL Expression
> 
> Is there any API that allows me do some processing (I want to do
> additional updates based on the insert statement) just before
> executing an insert statement using SQL Expression?
> 
> I dont want to do this during compile time (@Compiles(Insert)) as I
> will be doing some database updates and this is not desirable for
> every compilation e.g., just a simple print should not do this
> additional processing.
>

SA 0.7 generates events both at the ORM level and at the SQL level. See:

http://www.sqlalchemy.org/docs/07/core/event.html

http://www.sqlalchemy.org/docs/07/core/events.html

For example, there is a 'before_execute' event which you could listen
for, and look for INSERT clauses.

If you can't upgrade to 0.7, you might be able to use a ConnectionProxy:

http://www.sqlalchemy.org/docs/07/core/interfaces.html

Hope that helps,

Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to