Advertisement
Guest User

Untitled

a guest
Mar 27th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. import psycopg2
  2.  
  3. conn = psycopg2.connect(database="prueba", user="usuario", password="usuario", host="127.0.0.1", port="5432")
  4. print "conexion a la base de datos"
  5.  
  6. cur = conn.cursor()
  7.  
  8. cur.execute("INSERT INTO LIBROS (ID,NOMBRE) \
  9. VALUES (3, 'libro3c' )");
  10.  
  11. conn.commit()
  12. print "carga realizada correctamente";
  13. conn.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement