are you replicating via calling session.flush() for two different  
sessions ?  While I agree with Jonathan that its better for you to  
just use an existing database replication solution, a solution  
embedded into SA would probably work better as a MapperExtension that  
handles after_insert() and after_update() events and updates the row  
directly to the table at that point, rather than using a second session.

to do it exactly how you want would involve digging into the managed  
attributes of the object and forcing each attribute to be "dirty" for  
which there is not an API to allow that, and would probably break  
other things, such as:

        obj._state.original.data[propname] = 'something other than the  
current value'



On Jul 12, 2006, at 2:23 PM, Steve Zatz wrote:

> I am trying to find the most efficient way to keep two databases in
> sync.  There are multiple tables in the database and each row has a
> "dirty" flag if something has changed since the last sync.  I am
> pickling session objects and passing them back and forth to
> applications that are managing each of the databases.  While it is
> working, I have code like:
>
> for col_name in [col.name for col in klass.c]:
>      setattr(db1_row_obj, col_name, getattr(db2_row_obj, col_name))
>
> As you can see, I am just setting each column in an row needing
> updating to the value of each column in the "changed" row.
>
> My question is whether there is some way to just force SA to update
> every column in a table row from a session query row object.  Since
> the row object containing the updates will be an unpickled object from
> another database that was merged into the current session, it will
> look like nothing in that row object has changed but I want to force a
> database update and have the updated row overwrite everything in that
> row in the database.  There is a uuid that allows the rows to be
> matched.  Thanks for any 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

Reply via email to