[sqlalchemy] memory usage of the session in a loop
Hello, When a loop is constructed out of a query, eg : for a in query: print a where query is a query that returns objects. and you look at the identity_map of the session, inside the loop, you see that it contains all objects -- 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.
[sqlalchemy] memory usage of the session in a loop
Hello, When a loop is constructed out of a query, eg : for a in query: print a where query is a query that returns objects. and you look at the identity_map of the session, inside the loop, you see that it contains all objects the query will return. I would appear to me that only one object at a time is needed during the loop, and so the identity map should only contain 1 instance. Is my understanding wrong, or am I missing something ? Thank you and best regards, Erik -- 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.
Re: [sqlalchemy] memory usage of the session in a loop
please see Query.yield_per() in the documentation. On May 23, 2011, at 3:48 PM, erikj wrote: Hello, When a loop is constructed out of a query, eg : for a in query: print a where query is a query that returns objects. and you look at the identity_map of the session, inside the loop, you see that it contains all objects the query will return. I would appear to me that only one object at a time is needed during the loop, and so the identity map should only contain 1 instance. Is my understanding wrong, or am I missing something ? Thank you and best regards, Erik -- 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. -- 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.