summaryrefslogtreecommitdiff
path: root/models/artist.py
diff options
context:
space:
mode:
authorMichaël Ball <michael.ball@gmail.com>2015-08-09 14:44:55 +0100
committerMichaël Ball <michael.ball@gmail.com>2015-08-09 14:44:55 +0100
commit6b5c87d5c35ebbac6f7fbcac1a722bd0b3148e04 (patch)
treeefc2b776dad1307d4b8b78a517e9789852b4dc31 /models/artist.py
parent122ec1c9b283776b8f1fea5559d4317bdba5b977 (diff)
Improve performance - introduce transactions
Diffstat (limited to 'models/artist.py')
-rw-r--r--models/artist.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/models/artist.py b/models/artist.py
index 1afd516..2e69354 100644
--- a/models/artist.py
+++ b/models/artist.py
@@ -25,6 +25,8 @@ class Artist:
for album in self.albums:
album.delete()
+ cursor.execute("BEGIN TRANSACTION")
+
delete_sql = "DELETE FROM artist WHERE id = ?"
cursor.execute(delete_sql, (self.id,))
@@ -34,6 +36,8 @@ class Artist:
delete_album_rel_sql = "DELETE FROM album_artist WHERE artist_id = ?"
cursor.execute(delete_album_rel_sql, (self.id,))
+ cursor.execute("COMMIT TRANSACTION")
+
return True
@property
@@ -152,4 +156,4 @@ class Artist:
musicbrainz_artistid=row[3])
)
- return artist
+ return artists