Skip to content

Instantly share code, notes, and snippets.

View ejstronge's full-sized avatar

Edward J. Stronge ejstronge

View GitHub Profile
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
# Simple database and session wrapper. I use it in my Flask app too.
class Database(object):
def __init__(self):
self.session_maker = sessionmaker()
self.session = scoped_session(self.session_maker)
self.engine = None