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.
Thanks!