On Sep 27, 2011, at 11:42 AM, Brian wrote: > hello all, > > I'm grabbing data from a Student Information System (SIS) about students and > then saving that data in a local database. I then query my local database to > create/modify/disable accounts in Active Directory and Google Apps. > > What I've been doing so far is the following: > > Set all students in the local database as inactive-- > for activestudent in am.session.query(am.Student).filter_by(active=1): > activestudent.active = 0 > Get all "active" records from SIS using an engine.execute(<sql statement>) > Merge data from SIS into the Student objects from the local database. > > This works well for synchronizing the data, any students leaving the school > get marked inactive and any updates in name or status are reflected in the > local database. > > What I can't do, though, is tell exactly what changed. I'd really like to > run functions based on what the changes are: disable students made inactive. > > I tried using session.dirty, but I think because I initially set active to 0, > every record object is marked, even if active reverts back to 1 through the > merge. > > I'd appreciate any ideas, or guidance in the right direction.
hm what if you set active to "0" after you've learned what you can about attribute change status ? > > Thanks! > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/sqlalchemy/-/Mq9tsqsugk0J. > To post to this group, send email to sqlalchemy@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. -- 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 sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.