Brad Clements wrote:
>
> I'm going to use backref to work around this, I bet that will resolve the
> problem, but I'm curious why the mapper doesn't discover foreignkeys
> itself and watch for direct manipulation..
>
>

it doesnt look at the foreign key values themselves; the ORM just looks at
established object relationships and matches up the primary/foreign keys
at flush time.  to do the whole thing in reverse, i think such a feature
would be hard to implement, would create lots of new, expected behaviors
to be maintained (thus making SA a lot more complicated not just under the
hood but in observed behavior), and is not extremely necessary, since if
youre knowingly manipulating fk values, why not just call expire() on the
object so it refreshes from the identity map/DB?  i dont think there is a
similar feature in hibernate either (though i could be wrong).

heres the official blurb on this somewhat frequent question:

http://www.sqlalchemy.org/docs/unitofwork.myt#unitofwork_api_flush_whatis



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to