SQLAlchemy 0.5 Documentation

Multiple Pages | One Page
Version: 0.5.0beta1 Last Updated: 06/12/08 16:43:00

module sqlalchemy.engine.threadlocal

Provides a thread-local transactional wrapper around the root Engine class.

The threadlocal module is invoked when using the strategy="threadlocal" flag with create_engine(). This module is semi-private and is invoked automatically when the threadlocal engine strategy is used.

class TLConnection(Connection)

def __init__(self, session, connection, **kwargs)

Construct a new TLConnection.

def begin(self, **kwargs)
def begin_nested(self)
def begin_twophase(self, xid=None)
def close(self)
def in_transaction(self)
session = property()
back to section top

class TLEngine(Engine)

An Engine that includes support for thread-local managed transactions.

The TLEngine relies upon its Pool having "threadlocal" behavior, so that once a connection is checked out for the current thread, you get that same connection repeatedly.

def __init__(self, *args, **kwargs)

Construct a new TLEngine.

def begin(self, **kwargs)
def begin_nested(self)
def begin_twophase(self, **kwargs)
def commit(self)
def contextual_connect(self, **kwargs)

Return a TLConnection which is thread-locally scoped.

def prepare(self)
def rollback(self)
session = property()

Returns the current thread's TLSession

back to section top

class TLSession(object)

def __init__(self, engine)

Construct a new TLSession.

def begin(self, **kwargs)
def begin_twophase(self, xid=None)
def close(self)
def commit(self)
def get_connection(self, close_with_result=False)
def in_transaction(self)
def is_begun(self)
def prepare(self)
def reset(self)
def rollback(self)
back to section top

class TLTransaction(Transaction)

def __init__(self, trans, session)

Construct a new TLTransaction.

def close(self)
def commit(self)
is_active = property()
connection = property()
def prepare(self)
def rollback(self)
def __enter__(self)
def __exit__(self, type, value, traceback)
back to section top
Up: API Documentation | Previous: module sqlalchemy.engine.strategies | Next: module sqlalchemy.engine.url