On Jan 24, 2010, at 7:22 AM, Faheem Mitha wrote:

> I'm belatedly following up to this earlier posting.
> 
> The problem there was that I wasn't setting autocommit=True in
> text(). However, I was wondering what I can do if I want to directly
> write
> 
> conn.execute("somestuff")
> conn.close()
> 
> and have it autocommitted, rather than using text(). The execute()
> function doesn't appear to have an 'autocommit' option. What can I do
> to have a autocommit happen in this case?


we dont have a per-connection autocommit option, yet.    but I have ideas on 
how to introduce that.      but for now if you don't send the option along in 
the statement, you'd have to do it explicitly, ie. trans = conn.begin(); 
conn.execute(); trans.commit().



> 
>                                                       Regards, Faheem.
> 
> On Wed, 7 Oct 2009 17:37:51 -0400 (EDT), Faheem Mitha
> <[email protected]> wrote:
> 
>> 
>> Hi,
>> 
>> When running this function with postgresql 8.4 and sqla 0.5.5,
>> 
>> def test(dbstring):
>>    from sqlalchemy import create_engine
>>    db = create_engine(dbstring)
>>    conn = db.connect()
>>    from sqlalchemy.sql import text
>>    gq = text("""
>>    SET search_path TO public;
>>    DROP SCHEMA IF EXISTS foo CASCADE;
>>    CREATE SCHEMA foo;
>>    """)
>>    conn.execute(gq)
>>    conn.close()
>> 
>> the schema foo is not created. However, removing the
>> 
>> SET search_path TO public;
>> 
>> line makes it work. This is not the case when issuing these commands 
>> directly via psql. Any idea what might be going on here?
>> 
>>                                                      Regards, Faheem.
>> 
>> --~--~---------~--~----~------------~-------~--~----~
>> 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
>> -~----------~----~----~----~------~----~------~--~---
>> 
>> 
> 
> -- 
> 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.
> 

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