[ckan-changes] commit/ckan: 2 new changesets

Bitbucket commits-noreply at bitbucket.org
Thu Jul 14 18:30:41 UTC 2011


2 new changesets in ckan:

http://bitbucket.org/okfn/ckan/changeset/98d72bbcf969/
changeset:   98d72bbcf969
branch:      feature-1141-moderated-edits-ajax
user:        John Glover
date:        2011-07-14 20:25:56
summary:     [moderatededits] remove eagerload calls that D. Raznick's benchmarks show are slowing down the query
affected #:  1 file (258 bytes)

--- a/ckan/controllers/tag.py	Fri Jul 08 15:16:24 2011 +0100
+++ b/ckan/controllers/tag.py	Thu Jul 14 19:25:56 2011 +0100
@@ -49,9 +49,6 @@
     def read(self, id):
         query = model.Session.query(model.Tag)
         query = query.filter(model.Tag.name==id)
-        query = query.options(eagerload_all('package_tags.package'))
-        query = query.options(eagerload_all('package_tags.package.package_tags.tag'))
-        query = query.options(eagerload_all('package_tags.package.resource_groups_all.resources_all'))
         c.tag = query.first()
         if c.tag is None:
             abort(404)


http://bitbucket.org/okfn/ckan/changeset/0c06269b0272/
changeset:   0c06269b0272
branch:      feature-1141-moderated-edits-ajax
user:        John Glover
date:        2011-07-14 20:28:02
summary:     [moderatededits] use revision tables for Tag queries
affected #:  1 file (83 bytes)

--- a/ckan/model/tag.py	Thu Jul 14 19:25:56 2011 +0100
+++ b/ckan/model/tag.py	Thu Jul 14 19:28:02 2011 +0100
@@ -60,15 +60,17 @@
     @classmethod
     def all(cls):
         q = Session.query(cls)
-        q = q.distinct().join(cls.package_tags)
-        q = q.filter(PackageTag.state == 'active')
+        q = q.distinct().join(PackageTagRevision)
+        q = q.filter(PackageTagRevision.state == 'active')
         return q
 
     @property
     def packages_ordered(self):
-        ## make sure packages are active
-        packages = [package for package in self.packages 
-                    if package.state == State.ACTIVE]
+        q = Session.query(Package)
+        q = q.join(PackageTagRevision)
+        q = q.filter(PackageTagRevision.tag_id == self.id)
+        q = q.filter(PackageTagRevision.state == 'active')
+        packages = [p for p in q]
         ourcmp = lambda pkg1, pkg2: cmp(pkg1.name, pkg2.name)
         return sorted(packages, cmp=ourcmp)

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list