Hi guys, I've been saying this quite a few times in the past couple of days, to various people, but SQLAlchemy is intensely good. Well done. :)
Anyway, I have a slightly insane use case which may require me to do something like this: - Define a mapper for some table - Instantiate an object of the mapper class with default values only - Save this instance in the current session - Set values on the mapper class instance one-by-one, in response to various event - Flush at a request boundary Essentially, I'm dealing with a framework that has a storage layer abstraction which is a little broken. It asks the storage to save values one-by-one, and there is no well-defined way to know when it's done saving values. Previous attempts at SQL integration fell down on things like NOT NULL constraints, because they would essentially issue one UPDATE statement for each column (well, an INSERT on the first one). I'd basically be something like: >>> entity = MappedEntity() >>> session.save(entity) >>> entity.field1 = "some value" >>> entity.field2 = "another value" >>> session.flush() Except that each of those lines would be called from different event handlers and not in such an orderly sequence. The main problem is that I don't know when the events stop coming, i.e. when the object is "complete". I know that it will complete before the request boundary, and I have a way to flush at a request boundary automatically. I guess what I'm after is a way to attach a "partial" object to a session, and them modify it. I can see that working if SA doesn't clone objects in the session, i.e. my object references still point to the thing in the session and SA doesn't attempt to validate the object as soon as it's saved in the session. Or is this just a really bad idea? :) Martin --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---