- clarified autocommit mechanism
#### Understanding Autocommit
-The above transaction example illustrates how to use `Transaction` so that several executions can take part in the same transaction. What happens when we issue an INSERT, UPDATE or DELETE call without using `Transaction`? The answer is **autocommit**. While many DBAPIs implement a flag called `autocommit`, the current SQLAlchemy behavior is such that it implements its own autocommit. This is achieved by searching the statement for strings like INSERT, UPDATE, DELETE, etc. and then issuing a COMMIT automatically if no transaction is in progress.
+The above transaction example illustrates how to use `Transaction` so that several executions can take part in the same transaction. What happens when we issue an INSERT, UPDATE or DELETE call without using `Transaction`? The answer is **autocommit**. While many DBAPIs implement a flag called `autocommit`, the current SQLAlchemy behavior is such that it implements its own autocommit. This is achieved by detecting statements which represent data-changing operations, i.e. INSERT, UPDATE, DELETE, etc., and then issuing a COMMIT automatically if no transaction is in progress. The detection is based on compiled statement attributes, or in the case of a text-only statement via regular expressions.
{python}
conn = engine.connect()
return "%s.%s.0x..%s" % (instance.__class__.__module__,
instance.__class__.__name__,
hex(id(instance))[-2:])
- return (instance.__class__.__module__ + "." + instance.__class__.__name__ +
- ".0x.." + hex(id(instance))[-2:])
def class_logger(cls):
return logging.getLogger(cls.__module__ + "." + cls.__name__)