SQLAlchemy 0.3 Documentation - module sqlalchemy.mods.threadlocal

# SQLAlchemy 0.3 Documentation

Multiple Pages | One Page
Version: 0.3.10 Last Updated: 07/20/07 17:20:04

### 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)

### class Objectstore(object)

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