it should work in theory, but i dont think this has been tested, so its possible something isnt quite right. what would be most helpful would be a small test program, connecting to sqlite, that creates the necessary tables (most likely just two tables), inserts some test data, then sets up the mappers against those two tables and illustrates the problem (which is something I could do myself since I see what youre trying to do, but im a little short on time this week).
On Aug 17, 2006, at 11:56 AM, Antonin ENFRUN wrote: > Hi. > Using SQLAlchemy 0.2.7 > > Dealing with legacy data, I want to map an object to two table : > > READONLY is a read only table, where I find legacy records. > READWRITE is a normal table, where I want to store new and updated > informations. > > I thought that using a secondary mapper on READONLY was the solution : > > class C_Individus(object): > def __repr__(self): > return "C_Individus %s" % (self.MATRICULE) > > ro_table = Table('READONLY', metadata, autoload=True) > rw_table = Table('READWRITE', metadata, autoload=True) > > pri_mapper = mapper(C_Individus, rw_table, primary_key = > [rw_table.c.MATRICULE]) > seq_mapper = mapper(C_Individus, ro_table, primary_key = > [ro_table.c.MATRICULE], non_primary=True) > > This way, I can fetch data into C_Individus from READONLY and > READWRITE and create new C_Individus wich are stored in READWRITE on > session.flush() > > However, any modification to an object from READONLY is lost : data > are not saved in READWRITE on session.flush() > > Is it normal, or have I done something wrong ? > > Is there a better solution, or should I try to abuse polymorphic > inheritance, to load data from an union of READONLY and READWRITE ? > > Thanks for your help ! > > ---------------------------------------------------------------------- > --- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Sqlalchemy-users mailing list > Sqlalchemy-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users