Advertisement
Guest User

Untitled

a guest
Apr 6th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. import psycopg2
  2.  
  3. conn = psycopg2.connect(
  4. host = "127.0.1.1",
  5. port = 26257,
  6. database="a",
  7. user="root",
  8. password="password")
  9.  
  10. cur = conn.cursor()
  11. cur.execute("create table test (x int, y int)")
  12. cur.execute("INSERT INTO test (x, y) VALUES (100, 101)")
  13. cur.execute("SELECT * FROM test;")
  14. cur.fetchone()
  15. conn.commit()
  16.  
  17.  
  18. cur.close()
  19. conn.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement