Hi!

My question is about automatic updating (__in memory__, not db) one_to_many 
relationships  before flushing the session. Is that possible?

Trivial example:

master_table = Table('master', metadata,
    Column('master_id', Integer, primary_key = True),
┘.
)

detail_table = Table('detail', metadata, 
    Column('detail_id', Integer, primary_key = True),
┘
    Column('master_id', Integer, ForeignKey("master.master_id"))

Objects and mappers are:

class Master(object):
        pass
Class Detail(object):
        pass

detail_mapper=mapper(Detail,detail_table)
detail_mapper.add_property('master_ref', relation(Master))

I get detail object and set detail.master_id to another value.
After change of detail.master_id we have:
detail.master_id<>detail.master_ref.master_id.

Can SA automatically switch detail.master_ref to the 
correct Master object?

Thanks in advance, alex.

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