I might turn it on in 0.7 and add an extra flag "autoflush_on_execute" just so 
people can turn it off if they don't like it.  0.7 is on track for beta 
releases in december or january.

You can make yourself a quick Session subclass that wraps execute(), if you 
wanted this behavior right now.



On Nov 29, 2010, at 3:56 AM, Emmanuel Cazenave wrote:

> Yes it surprised me. But I get your point.
> 
> Thanks you for your response.
> 
> On Nov 26, 9:41 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
>> I wouldn't say its a "bug" since its intentional.   But I'll grant the 
>> intention is up for debate.   I've always considered usage of execute() to 
>> mean, you're going below the level of the ORM and would like to control the 
>> SQL interaction directly, not to mention with as minimal overhead as 
>> possible, which is why it works that way currently.   It might be just as 
>> surprising to many users if execute() issued a whole series of insert/update 
>> statements as much as it was apparently surprising to you that it did not.
>> 
>> On Nov 26, 2010, at 1:49 PM, Emmanuel Cazenave wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hi,
>> 
>>> In a session which has some dirty objects, doing
>>> session.execute(sql_statement) doesn't not flush the dirty objects to
>>> the database before executing the sql_statement query.
>> 
>>> The session was initialized with  autoflush=True.
>> 
>>> Is it the expected behaviour ? Is it a bug ?
>> 
>>> Thanks
>> 
>>> --
>>> 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 more options, visit this group 
>>> athttp://groups.google.com/group/sqlalchemy?hl=en.
> 
> -- 
> 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 more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
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 more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to