> I hate to disagree here, and I can see what you're getting at, but  
> honestly, the "INSERT on save()" approach is exactly the naive active- 
> record-like pattern that SQLAlchemy's ORM was designed to get away from.
> 
> The way the unit of work functions, we dont generate ids until a flush  
> occurs.  Flushes dont occur unless you say flush(), or if you have  

I'm not saying flush on save. I'm saying flush at the last possible 
moment (which is what it does now) but I want "last possible moment" to 
include "program tried to access a database-generated field"

s1 = Something('foo1')
session.save(s1)
s2 = Something('foo2')
session.save(s2)
# Nothing flushed yet
s3 = Something('foo3')
session.save(s3)
url_for_foo = "/something?id=%d" % s3.id
# s3 should be flushed, nothing else though (since s3.id was accessed)

-Adam Batkin



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to