SQLAlchemy 0.3 Documentation

Version: 0.3.5 Last Updated: 03/18/07 18:39:07

module sqlalchemy.mods.threadlocal

This plugin installs thread-local behavior at the Engine and Session level.

The default Engine strategy will be threadlocal, producing TLocalEngine instances for create_engine by default.

With this engine, connect() method will return the same connection on the same thread, if it is already checked out from the pool. This greatly helps functions that call multiple statements to be able to easily use just one connection without explicit close statements on result handles.

On the Session side, module-level methods will be installed within the objectstore module, such as flush(), delete(), etc. which call this method on the thread-local session.

Note: this mod creates a global, thread-local session context named sqlalchemy.objectstore. All mappers created while this mod is installed will reference this global context when creating new mapped object instances.

Module Functions

def assign_mapper(class_, *args, **kwargs)
back to section top

class Objectstore(object)

def __init__(self, *args, **kwargs)
session = property()
back to section top