On Dec 14, 2010, at 2:53 PM, Russell Warren wrote:

> Thanks very much for the explanations.
> 
>>> What would be really nice is a parameter for Session() that would, for
>>> dialects that support it (it has been in the SQL standard since '92 it
>>> seems [2]), set the isolation level the session should use and queue
>>> up a "SET TRANSACTION ISOLATION LEVEL ..." command to be emitted
>>> immediately after the decision is made to emit the "BEGIN" that is
>>> relevant for the dialect.  For non-standard implementations like
>>> sqlite some interpretation would obviously be needed, though.
>> 
>> This is what ticket 2001 proposes.   
>> session.connection().execution_options(isolation_level='foo') and you're 
>> good to go.
> 
> Great!
> 
> So for the time being (until ticket 2001 makes it, if it does), is
> below the correct summary of the transaction isolation options
> available when using SqlAlchemy?
> 
> PostgreSQL:
> - per-transaction isolation levels not possible, even with direct
> execution of "SET TRANSACTION ISOLATION LEVEL" syntax (due to psycopg2
> implementation, other APIs may differ)
> - transaction isolation must be set at a global level using the
> isolation_level kwarg on create_engine()
> 
> Sqlite:
> - global isolation level setup via create_engine()
> - per-transaction isolation changes may be possible with direct
> fiddling of autocommit... check pysqlite driver
> 
> All other DBMS:
> - no direct SqlAlchemy support of any kind (global/per-connection/per-
> transaction) for changing transaction isolation levels
> - Direct manipulation with SQL statements may be possible, but check
> the docs on the DBAPI driver in use (or snoop SQL emitted by driver)
> to confirm functionality

isolation_level kwarg can work for other DBs if the option is implemented for 
them.   The work in any case is as you mention, the driver-level and SQL level 
details need to be confirmed.    Ticket 2001 in turn is a slight rearrangement 
of the dialect-level functionality to work at the execution_options level as 
well as at the engine level.




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