While the docs are pretty good at describing flush dependencies, side-effects and how to issue, it, there is not a lot of clarity around what all it actually does.
I can surmise that it pushes all non-saved session state to the DB (committing or not depending upon whether a transaction is currently in process), but it's not clear if it auto-loads any created PKeys for those rows. I also believe it leaves those objects in the identity map (rather than expiring them) for further use, but it does not state this explicitly. Whether or not you agree the docs could be clarified about such points, here's a summary of what i'm trying to do: We have much data loaded in batch to many tables. Any given batch is tied to one specific time window. We keep a "time-window-id" on every row, in every table. This allows us to delete and reload all data related to a given time-batch at any future point. You can think of it as a persisted transaction id. We want this "time-window" record created AND ON DISK before adding a lot of other data to the session. This wish is driven a bit by paranoia, but also by the fact that we're manually controlling (not letting the ORM do it) FKey relationships in a few special circumstances. So we need that ID in memory for records in which the ORM is not tracking the relationships. Is "flush" the right way to make sure this record is persisted and reloaded NEAR the beginning of our batch transaction? Thanks for all tips! D -- 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 http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
