Hi Mike Thank you for your quick and thoughtful response as usual!
> so the quick and dirty approach is a flag I'm not enthused about, > nevertheless I don't plan on removing, called > _enable_transaction_accounting, > Yes I saw this when poking around in the source code - it does seem like a bit of a backwards step; I will try and solve my problem without that :) > The more architectural answer is that the ORM considers these objects to > be proxies for state within a database transaction. > Understood. I guess we are going a bit outside the intended SQLAlchemy use-case here. > > You can do this kind of pattern by having the ORM objects represent the > GUI state as "detached" objects, then copy the state of those objects > into the session using a method like Session.merge. > I think this is what I will probably end up doing. There's a quite a bit of business logic attached to the mapped classes - for example the 'Actions' are polymorphic and contain methods that are 'recipes' for generating a standard set of steps based on the attributes of the action. > > The best way would be that the GUI has its own dedicated data structure > that is distinct from your ORM model. Yes, I think you are right here - though the business logic I described above makes this a bit troublesome. In the past I have done this sort of thing, created a throwaway mapped class and populated it with data so that I could make use of its methods. A more high-end way of representing this is to create "action" objects > which represent things the user does, Deluxe indeed.. I'll have a think about that, though it is probably overkill for the simple app I am writing. Every time I do a GUI with SQLAlchemy I try a slightly different approach - it is tantalising because each time I think I have cracked the perfect pattern but it always ends up being slightly more complicated than I thought! I can't come up with any suggestions on how to do it better though. Keep up the good work - we love SQLAlchemy at my firm. It is directly responsible for keeping track of several billion dollars worth of financial products and I sleep soundly at night having selected it as a platform :) -- 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 sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.