def active_folders( trans, folder ): # Stolen from galaxy.web.controllers.library_common (importing from which causes a circular issues). # Much faster way of retrieving all active sub-folders within a given folder than the # performance of the mapper. This query also eagerloads the permissions on each folder. return trans.sa_session.query( trans.app.model.LibraryFolder ) \ .filter_by( parent=folder, deleted=False ) \ .options( eagerload_all( "actions" ) ) \ .order_by( trans.app.model.LibraryFolder.table.c.name ) \ .all()
def active_folders(trans, folder): # Stolen from galaxy.web.controllers.library_common (importing from which causes a circular issues). # Much faster way of retrieving all active sub-folders within a given folder than the # performance of the mapper. This query also eagerloads the permissions on each folder. return trans.sa_session.query( trans.app.model.LibraryFolder ) \ .filter_by( parent=folder, deleted=False ) \ .options( eagerload_all( "actions" ) ) \ .order_by( trans.app.model.LibraryFolder.table.c.name ) \ .all()
def get_history_datasets( self, trans, history ): """ Returns history's datasets. """ query = ( trans.sa_session.query( trans.model.HistoryDatasetAssociation ) .filter( trans.model.HistoryDatasetAssociation.history == history ) .options( eagerload( "children" ) ) .join( "dataset" ) .options( eagerload_all( "dataset.actions" ) ) .order_by( trans.model.HistoryDatasetAssociation.hid ) .filter( trans.model.HistoryDatasetAssociation.deleted == False ) #noqa .filter( trans.model.Dataset.purged == False ) ) return query.all()