Mike Bayer  committed 976ca95

added count/count_by to assignmapper, plus a test in activemapper to try it out

  • Participants
  • Parent commits db2b175

Comments (0)

Files changed (3)

 - fixes to Session expunge/update/etc.
 - select_table mappers *still* werent always compiling
 - fixed up Boolean datatype
+- added count()/count_by() to list of methods proxied by assignmapper;
+this also adds them to activemapper
 - fixed endless loop bug in select_by(), if the traversal hit

File lib/sqlalchemy/ext/

         extension = ctx.mapper_extension
     m = mapper(class_, extension=extension, *args, **kwargs)
     class_.mapper = m
-    for name in ['get', 'select', 'select_by', 'selectone', 'get_by', 'join_to', 'join_via']:
+    for name in ['get', 'select', 'select_by', 'selectone', 'get_by', 'join_to', 'join_via', 'count', 'count_by']:
         monkeypatch_query_method(ctx, class_, name)
     for name in ['flush', 'delete', 'expire', 'refresh', 'expunge', 'merge', 'save', 'update', 'save_or_update']:
         monkeypatch_objectstore_method(ctx, class_, name)

File test/ext/

         self.assertEquals(len(results), 1)
+        self.assertEquals(Person.count(), 2)
 class testselfreferential(testbase.PersistTest):
     def setUpAll(self):
         global TreeNode