I believe #1 will iterate on the cursor retrieving one object from cursor on each iteration, while #2 retrieves all objects then processes the entire result set in Python.
Try changing #1 to use for o in session.query(Object).all() to retrieve all objects before doing the iteration, same as #2. > """ > #1. use session > output = '\n,'.join(['%s: %s %s %s %s %s %s %s %s'%(o.id, > > o._owner_id,o._created,o._created,o._creator_id, > > o.class_id,o.type,o.singular_label,o.plural_label) > for o in session.query(Object)]) > """ > > > #2. use raw sql > output = '\n,'.join([str(p) for p in session.connection().execute > (s).fetchall()]) > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---