Hi Michael,

I only noticed the activity on this thread today.

On Sat, 2010-08-14 at 11:07 -0400, Michael Bayer wrote:

> > reproduce the problem and it suggests the problem stems from some
> > behaviour of transactions or of the engine.base.Connection class.  I
> > don't quite know what to make of it yet, but I think it shows that the
> > effect of "passing it through" is being counteracted by something
> > else.  I ran this on Python 2.6.5 with SA 0.6.3 on Windows.
> 
> Postgresql and MS-SQL support transactional DDL, and I use this feature all 
> the time with SQLAlchemy which does nothing special to support them.

That is out of the question. This seems only related to SQLite.

> In addition, isolation_level=None with pysqlite disables the DBAPIs entire 
> transactional system.  SQLAlchemy relies upon this system to handle proper 
> transactional behavior.  Per their documentation, some statements will fail 
> if executed in a transaction - SQLAlchemy does not want to be involved in 
> reorganizing how the DBAPI wants to approach things, emitting manual 'begin' 
> and 'commit' strings, etc.

Reading the pysqlite source, all that this magic isolation_level setting
does is to emit an begin statement in front of UPDATE, DELETE, INSERT
and REPLACE commands. And implicitly commit whenever any other
non-select statement is executed (which includes SAVEPOINT commands!).

I don't think it makes a huge difference for SQLAlchemy to rely on this
insertion of "begin" statements.

References:

Emitting begin (via _pysqlite_connection_begin):
http://code.google.com/p/pysqlite/source/browse/src/cursor.c?r=2.6.0#598

That's the only invocation to _pysqlite_connection_begin. After reading
a bit more, I can see your point. Setting isolation_level to None
actually disables the commit and rollback methods on cursor objects.
Whee!


> So I consider this a pysqlite bug, and they should offer a mode by which 
> there is no implicit commit for CREATE TABLE.
> 
> See http://docs.python.org/library/sqlite3.html#controlling-transactions 

Agreed.

Greetings, Torsten


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