Hello,

While working on a database test with nose, I dug into sqlalchemy 0.6.6 until I 
found these lines:

class DDLElement(expression.Executable, expression.ClauseElement):
    """Base class for DDL expression constructs."""

    _execution_options = expression.Executable.\
                            _execution_options.union({'autocommit':True})

In my nose test against postgresql, I emit a bunch of DDL, perform the test and 
then roll back the whole shebang which conveniently makes it look like I didn't 
touch the database. Obviously, the emitted commits were getting in my way, so I 
wrote this:

class NoCommitDDL(DDL):
    def __init__(self,*args,**kw):
        super(NoCommitDDL,self).__init__(*args,**kw)
        unfrozen = dict(self._execution_options)
        del unfrozen['autocommit']
        self._execution_options = frozendict(unfrozen)

DDL = NoCommitDDL

I still feel like I am missing something though. I understand that PostgreSQL 
is perhaps one of few databases to allow for transaction-aware DDL, but why is 
a commit emitted for the DDL for any database, when the database makes it 
implied anyway?

Thanks.

Cheers,
M

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@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