conn.close() will ultimately result in the underlying connection  
being returned to the connection pool.  you probably want to turn the  
AUTOCOMMIT flag back off before doing so.

thats why it might be nicer to build some construct in SA for  
operations like this to be easier.

On Sep 19, 2006, at 4:25 PM, Sol wrote:

> Michael Bayer wrote:
>> we generally leave autocommit turned off on the DBAPI connections  
>> (which
>> implies theres always a transaction in progress).  you might want  
>> to see
>> if a straight psycopg2 connection, with autocommit turned on, can  
>> even
>> do this.  through SA, you can get at the underlying connection and do
>> the same thing or we can add a flag of some kind.
>>
> Plain psycopg2 connection work for me.
>
> import psycopg2.extensions
> conn = database.metadata.engine.connect()
> conn.connection.connection.set_isolation_level 
> (psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
> conn.execute('VACUUM FULL ANALYZE;')
>
> The only mess is that this is not db independent anymore. Anyway, as
> VACUUM is not db independent this solves my problem satisfactorily.
>
> Thanks a lot for the hint!
>
> Further more is it sufficient to call
>
> conn.close()
>
> after the above code to keep the internal state of SA untouched?
>
>
> -- 
> Cheers, Sol.
>
> ---------------------------------------------------------------------- 
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to  
> share your
> opinions on IT & business topics through brief surveys -- and earn  
> cash
> http://www.techsay.com/default.php? 
> page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Sqlalchemy-users mailing list
> Sqlalchemy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to