Skip to content

Instantly share code, notes, and snippets.

@robertberry-zz
Created December 4, 2012 10:46
Show Gist options
  • Save robertberry-zz/4202591 to your computer and use it in GitHub Desktop.
Save robertberry-zz/4202591 to your computer and use it in GitHub Desktop.
SQL Alchemy update
def update_existing_accounts(session):
q = session.query(StaffMember.email, StaffMember.honourific).\
filter(EPrintUser.staff_id == StaffMember.id).\
as_scalar()
return session.query(EPrintUser).\
update({EPrintUser.email: q.email,
EPrintUser.honourific: q.honourific})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment