Custom Oven Drivers

It’s possible to implement your own custom oven drivers to get a desired behavior for the engine or the session. An abstract base class is provided for you to inherit from called OvenBase. You need to implement an init_engine that returns a SQLAlchemy engine, and an init_session that returns a SQLAlchemy sessionmaker. The default __init__ method sets the output of both of these to to the oven’s engine and Session properties respectively.


Remember to use recipe’s built in settings to handle any configuration options/settings you made need for your driver.


class recipe.oven.base.OvenBase(connection_string=None)[source]

Base class for ovens

abstract init_engine(connection_string=None, **kwargs)[source]

Initializes a SQLAlchemy Engine for a given connection string with all other keyword arguments passed to the create_engine function. The connection uses pre-ping to verify connections.

  • self (Oven) – a reference to ourselves

  • connection_string (str) – a reference to ourselves

  • kwargs (dict) – a collection of arguments passed to the engine


A SQLAlchemy Engine with connection checking

Return type


abstract init_session()[source]

Initializes a SQLAlchemy Session with the Oven’s engine


self (Oven) – a reference to ourselves


A SQLAlchemy Session using self.engine

Return type