Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # snippetbucket.com, author: tejas tank. Feb-2017
- # Backup table
- import psycopg2
- conn = psycopg2.connect(database="sch_mgmtss", user="", password="", host="", port="")
- print "Opened database successfully"
- cur = conn.cursor()
- fo = open("j.csv", "wb")
- c = 1
- while(c < 287315):
- cur.execute("SELECT * FROM mail_message LIMIT 1 OFFSET %s"%c)
- try:
- rows = cur.fetchone()
- print rows
- fo.write("%s \n"%repr(rows))
- except:
- print"c is not imported"
- fo.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement