On Apr 11, 2012, at 12:12 PM, Paddy Mullen wrote:

> I could have sworn I saw conflicting behaviour.
> 
>  My after_insert would run, and the instance would have an id, it would then 
> enqueue a task in celery.  On the other side (in another process), celery 
> would run that task, make a query against that database for that ID, and the 
> ID wouldn't be in the database.

oh, that's completely different.   Your flush is inside of a transaction.   
Your newly generated id *will not* be exposed to the outside world until the 
transaction commits.    If you're spawning off celery tasks that are dependent 
on the newly flushed data, you *must* use after_commit() for that.  Not just 
for isolation purposes, but what if your transaction failed and was rolled back 
- then celery would be failing there as well.




-- 
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