Thank you Simon, that helps! Jens
> I think the idea of processing the rows in chunks is to limit the > memory usage of the Python process. Until you call session.flush(), > all your modifications are held in memory. For small numbers of rows > this isn't a problem, but for huge numbers, it might be. > > In practice, it may not actually make a difference for this example, > because the default session configuration is to autoflush whenever you > call session.query(). > > As to whether this is preferred over Table.update(), it really depends > on your use case. Table.update() will usually be faster, because all > the work will be done by the database itself. If the changes you are > trying to make can be expressed in SQL (ie. they don't have > complicated dependencies or require outside information), and you are > happy to resynchronise your session afterwards if necessary, then > Table.update() is fine. > > Hope that helps, > > Simon > -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
