Minor tweak to see what is going on with delete()
[ckanext-ga-report.git] / ckanext / ga_report / ga_model.py
blob:a/ckanext/ga_report/ga_model.py -> blob:b/ckanext/ga_report/ga_model.py
--- a/ckanext/ga_report/ga_model.py
+++ b/ckanext/ga_report/ga_model.py
@@ -168,12 +168,11 @@
     count = model.Session.query(GA_Url).\
             filter(GA_Url.period_name == 'All').count()
     log.debug("Deleting %d 'All' records" % count)
-    model.Session.query(GA_Url).\
+    count = model.Session.query(GA_Url).\
             filter(GA_Url.period_name == 'All').delete()
-    log.debug("Query: %s" % model.Session.query(GA_Url).
-            filter(GA_Url.period_name == 'All'))
-
-    model.Session.clufhs()
+    log.debug("Deleted %d 'All' records" % count)
+
+    model.Session.flush()
     model.Session.commit()
     model.repo.commit_and_remove()