Advertisement
Guest User

Untitled

a guest
Mar 6th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. conn = psycopg2.connect("dbname=<mydbname> user=postgres password=<mypassword>")
  2. cur = conn.cursor()
  3. output = StringIO.StringIO()
  4. output.write('Citizen CainetMy_API_idn')
  5. cur.copy_from(output, 'movie', columns=('title','api_id'))
  6. conn.commit()
  7.  
  8. output.seek(0) #put the position of the buffer at the beginning
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement