Created
July 11, 2014 22:36
-
-
Save christophlsa/75705f385d01f6e8c7cd to your computer and use it in GitHub Desktop.
This file contains 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
#!/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