Skip to content

Instantly share code, notes, and snippets.

@christophlsa
Created July 11, 2014 22:36
Show Gist options
  • Save christophlsa/75705f385d01f6e8c7cd to your computer and use it in GitHub Desktop.
Save christophlsa/75705f385d01f6e8c7cd to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import psycopg2
import pprint
def main():
sql = "SELECT id FROM member WHERE invite_code IN ("
with open("austritte.txt", "r") as fobj:
for line in fobj:
if line != "":
sql = sql + "\n '" + line.replace("\n", "") + "',"
sql = sql[:-1] + "\n);"
psqlcon = "host='' dbname='liquid_feedback_lsa'"
conn = psycopg2.connect(psqlcon)
cursor = conn.cursor()
cursor.execute(sql)
print "BEGIN;"
for row in cursor:
print "SELECT delete_member(%s);" % (row[0])
print "COMMIT;"
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment