Advertisement
Guest User

Untitled

a guest
Apr 1st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. import psycopg2
  2. conn = psycopg2.connect("host='localhost' dbname='my_database' user='postgres' password='secret'")
  3. cursor = conn.cursor()
  4. cursor.execute("SELECT * FROM books")
  5. records = cursor.fetchall()
  6. for row in rows:
  7.     print(row[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement