]> git.decadent.org.uk Git - dak.git/commitdiff
dominate: Use a bulk DELETE
authorNiels Thykier <niels@thykier.net>
Thu, 31 Dec 2015 11:12:33 +0000 (11:12 +0000)
committerNiels Thykier <niels@thykier.net>
Thu, 31 Dec 2015 11:13:38 +0000 (11:13 +0000)
Signed-off-by: Niels Thykier <niels@thykier.net>
dak/dominate.py

index accb0df8f628efce999ad82121d8140565df4d66..600d1127d927f0011cab4e4939213080bdf7818e 100755 (executable)
@@ -87,11 +87,11 @@ def deleteAssociations(table, idList, session):
     query = """
         DELETE
             FROM %s
-            WHERE id = :id
+            WHERE id IN :idList
     """ % table
-    params = [{'id': id} for id in idList]
-    if len(params) == 0:
+    if not idList:
         return
+    params = {'idList': tuple(idList)}
     session.execute(query, params)
 
 def doDaDoDa(suite, session):