diff --git a/mutalyzer/db/queries.py b/mutalyzer/db/queries.py
index d457b60c1d60f9774991ed703528c2b15cb34a8c..230804d74fb477e091b3971eed19942ed89e18e6 100644
--- a/mutalyzer/db/queries.py
+++ b/mutalyzer/db/queries.py
@@ -115,8 +115,7 @@ def update_transcript_protein_link(transcript_accession=None,
                        protein_accession)
 
     # Delete any related existing links.
-    links = TranscriptProteinLink.query.filter(or_(*clauses))
-    session.delete(links)
+    TranscriptProteinLink.query.filter(or_(*clauses)).delete()
     session.commit()
 
     # There is a race condition here between deleting old links and adding the