def groupfinder(authorname, request): dbsession = DBSession() author = dbsession.query(Author).filter_by(author_name=authorname).first() groups = dbsession.query(AccessGroup).select_from(join(AuthorAccessGroupMap, AccessGroup, AuthorAccessGroupMap.group_id==AccessGroup.id)).filter(AuthorAccessGroupMap.author_id==author.id).all() return [group.group_name for group in groups]
def initialize_sql(engine): DBSession.configure(bind=engine) mi_schema.Base.metadata.bind = engine
def session_remove_callback(request): DBSession.remove()