def get_pools_data(session, pagination=None): orm = OrmGdbModel(session) query = orm.get_query(func.count(OrmGdbModel.GdbMapper.ID).label('COUNT'), OrmPooldbModel.PooldbMapper.ID, OrmPooldbModel.PooldbMapper.DESCRIPTION, OrmPooldbModel.PooldbMapper.USER_SUBMITTED, OrmPooldbModel.PooldbMapper.POOLNAME ) query = query.join(OrmGdbModel.GdbMapper.pooldb) query = query.filter(OrmPooldbModel.PooldbMapper.HIDDEN == 'no') query = query.filter(OrmGdbModel.GdbMapper.HIDDEN == 'no') query = query.filter(OrmGdbModel.GdbMapper.REVIEWEDBY != None) query = query.group_by(OrmPooldbModel.PooldbMapper.ID) if pagination is not None: pagination.num_of_pages = query.count() query = pagination.paginate(query) data = query.all() rows = [] for row in data: row_dict = { 'id': row.ID, 'name': row.POOLNAME, 'description': row.DESCRIPTION, 'genotypes_count': row.COUNT } rows.append(row_dict) res = {'data': rows, 'count': len(rows), 'geno_num': orm.get_num_of_rows()} return res
def get(self): db_session = sql_db_engine.create_session() orm = OrmGdbModel(db_session) rows_num = orm.get_num_of_rows() rendered = render_template('mainView.html', rows_num=rows_num) db_session.commit() db_session.close() return Response(rendered, mimetype='text/html')