Don't try to execute DDL in a transactional context.
This commit is contained in:
parent
7f881b440b
commit
a797e90357
@ -66,10 +66,7 @@ class Database(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def op(self):
|
def op(self):
|
||||||
if hasattr(self.local, 'connection'):
|
ctx = MigrationContext.configure(self.engine)
|
||||||
ctx = MigrationContext.configure(self.local.connection)
|
|
||||||
else:
|
|
||||||
ctx = MigrationContext.configure(self.engine)
|
|
||||||
return Operations(ctx)
|
return Operations(ctx)
|
||||||
|
|
||||||
def _acquire(self):
|
def _acquire(self):
|
||||||
@ -89,7 +86,10 @@ class Database(object):
|
|||||||
|
|
||||||
def begin(self):
|
def begin(self):
|
||||||
""" Enter a transaction explicitly. No data will be written
|
""" Enter a transaction explicitly. No data will be written
|
||||||
until the transaction has been committed. """
|
until the transaction has been committed.
|
||||||
|
|
||||||
|
**NOTICE:** Schema modification operations, such as the creation
|
||||||
|
of tables or columns will not be part of the transactional context."""
|
||||||
if not hasattr(self.local, 'connection'):
|
if not hasattr(self.local, 'connection'):
|
||||||
self.local.connection = self.engine.connect()
|
self.local.connection = self.engine.connect()
|
||||||
if not hasattr(self.local, 'tx'):
|
if not hasattr(self.local, 'tx'):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user