SQLAlchemy 0.3 Documentation - module sqlalchemy.engine.strategies

# SQLAlchemy 0.3 Documentation

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

### module sqlalchemy.engine.strategies

Define different strategies for creating new instances of sql.Engine.

By default there are two, one which is the "thread-local" strategy, one which is the "plain" strategy.

New strategies can be added via constructing a new EngineStrategy object which will add itself to the list of available strategies here, or replace one of the existing name. this can be accomplished via a mod; see the sqlalchemy/mods package for details.

### class DefaultEngineStrategy(EngineStrategy)

def create(self, name_or_url, **kwargs)
def get_engine_cls(self)
def get_pool_provider(self, url, pool)
def pool_threadlocal(self)
back to section top

### class EngineStrategy(object)

Define a function that receives input arguments and produces an instance of sql.Engine, typically an instance sqlalchemy.engine.base.Engine or a subclass.

def __init__(self, name)

Construct a new EngineStrategy object.

Sets it in the list of available strategies under this name.

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

Given arguments, returns a new sql.Engine instance.

back to section top

### class MockEngineStrategy(EngineStrategy)

Produces a single Connection object which dispatches statement executions to a passed-in function

def __init__(self)
def create(self, name_or_url, executor, **kwargs)
back to section top

### class PlainEngineStrategy(DefaultEngineStrategy)

def __init__(self)
def get_engine_cls(self)
def get_pool_provider(self, url, pool)
def pool_threadlocal(self)
back to section top

### class ThreadLocalEngineStrategy(DefaultEngineStrategy)

def __init__(self)
def get_engine_cls(self)
def get_pool_provider(self, url, pool)
def pool_threadlocal(self)
back to section top