Commits

Mike Bayer committed 0a8f29d

docstrings for instances()/iterate_instances()

  • Participants
  • Parent commits f8691c7

Comments (0)

Files changed (1)

lib/sqlalchemy/orm/query.py

         return self.iterate_instances(result, querycontext)
 
     def instances(self, cursor, __context=None):
+        """Given a ResultProxy cursor as returned by connection.execute(), return an ORM result as a list.
+
+        e.g.::
+        
+            result = engine.execute("select * from users")
+            users = session.query(User).instances(result)
+
+        """
         return list(self.iterate_instances(cursor, __context))
 
     def iterate_instances(self, cursor, __context=None):
+        """Given a ResultProxy cursor as returned by connection.execute(), return an ORM result as an iterator.
+        
+        e.g.::
+        
+            result = engine.execute("select * from users")
+            for u in session.query(User).iterate_instances(result):
+                print u
+
+        """
         session = self.session
 
         context = __context