def update_album_trackcounts() : """Updates value Album.trackcount which caches the number of tracks per album for fast querying """ albums= Album.query.all() for (ctr,a) in enumerate(albums) : a.update_trackcount() if ctr % 100 ==0 : session.flush() print 'Processed album',ctr session.flush()
def update_album_trackcounts(): """Updates value Album.trackcount which caches the number of tracks per album for fast querying """ albums = Album.query.all() for (ctr, a) in enumerate(albums): a.update_trackcount() if ctr % 100 == 0: session.flush() print 'Processed album', ctr session.flush()
def update_artist_trackcounts() : """Updates value Artist.trackcount which caches the number of tracks per artist for fast querying. """ artists = Artist.query.all() for (ctr,a) in enumerate(artists) : a.update_trackcount() if ctr % 100 ==0 : session.flush() print 'Processed artist',ctr session.flush()
def update_artist_trackcounts(): """Updates value Artist.trackcount which caches the number of tracks per artist for fast querying. """ artists = Artist.query.all() for (ctr, a) in enumerate(artists): a.update_trackcount() if ctr % 100 == 0: session.flush() print 'Processed artist', ctr session.flush()
def verify_delete(vals,msg) : print vals.count(),msg if vals.count()==0 : return for v in vals: print v if get_raw_yesno('Delete them?') : for v in vals : try : session.delete(v) session.flush() except : print 'Could not delete',v,'probably because there are artist_sims for this artist'
def verify_delete(vals, msg): print vals.count(), msg if vals.count() == 0: return for v in vals: print v if get_raw_yesno('Delete them?'): for v in vals: try: session.delete(v) session.flush() except: print 'Could not delete', v, 'probably because there are artist_sims for this artist'
def delete_track(track) : session.delete(track) session.flush() #should this be a commit? # Updating albums and artists too for a in track.albums : a.update_trackcount() if a.trackcount==0 : session.delete(a) for a in track.artists : a.update_trackcount() if a.trackcount==0 : session.delete(a) commit()
def delete_track(track): session.delete(track) session.flush() #should this be a commit? # Updating albums and artists too for a in track.albums: a.update_trackcount() if a.trackcount == 0: session.delete(a) for a in track.artists: a.update_trackcount() if a.trackcount == 0: session.delete(a) commit()