Created
June 24, 2019 20:32
-
-
Save waltertschwe/39fa708ae4bafab2aa8c5b6319471116 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def import_fields(self, alerts): | |
| residents = self.meta.tables['application_resident'] | |
| for alert in alerts: | |
| resident = self.get_fields(alert) | |
| query = residents.select((residents.c.resident_number == resident['resident_number']) & (residents.c.facility_id == resident['facility_id'])) | |
| hello = query.execute() | |
| rows = hello.fetchall() | |
| if not rows: | |
| insert_stmt = insert(self.meta.tables['application_resident']).values(resident) | |
| self.con.execute(insert_stmt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment