def get_session(): """Get the Database Session for the server.""" session = getattr(g, 'dbsession', None) if session is None: session = sessionmaker(bind=engine)() g.dbsession = session return session