Skip to content

Instantly share code, notes, and snippets.

@jasonamyers
Created August 5, 2015 15:48
Show Gist options
  • Select an option

  • Save jasonamyers/1bb842812b3c3679a03a to your computer and use it in GitHub Desktop.

Select an option

Save jasonamyers/1bb842812b3c3679a03a to your computer and use it in GitHub Desktop.
from sqlalchemy import and_, or_, not_
q = select([tblthing.c.id, tblthing.c.zip, tblthing.c.structure])
conditions = or_()
for row in df.iterrows():
conditions.append(and_(tblthing.c.id=row['id'], tblthing.c.zip=row['zip']))
q = q.where(conditions)
for row in connection.execute(q):
print(row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment