Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- conn = psycopg2.connect("dbname=<mydbname> user=postgres password=<mypassword>")
- cur = conn.cursor()
- output = StringIO.StringIO()
- output.write('Citizen CainetMy_API_idn')
- cur.copy_from(output, 'movie', columns=('title','api_id'))
- conn.commit()
- output.seek(0) #put the position of the buffer at the beginning
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement