No, I can't truncate the table for other reasons, as I mentioned in my original question. :)
The issue here was not how to sync the data, but whether processed rows stay in session even though the objects (model instances) are discarded at the end of each iteration (each csv row), or in other words whether I have to expunge_all() or not.
It seems I don't have to (SQLAlchemy 0.7, PostgreSQL backend). Thanks! .oO V Oo. On 09/08/2011 06:47 PM, Victor Olex wrote:
Since you are effectively overwriting the table with new file contents, the fastest may well be to truncate the table then insert all contents. If you were to just append and update then session.merge() is convenient way to do this though I am not sure if the fastest.
-- 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.