Advertisement
Guest User

Untitled

a guest
Apr 20th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. import psycopg2
  2.  
  3. connection = psycopg2.connect(
  4. database="test",
  5. user="postgres",
  6. password="123",
  7. host="localhost",
  8. port=5432
  9. )
  10.  
  11. try:
  12. cursor = connection.cursor()
  13. check = '''SELECT * FROM testid WHERE "Property_ID" = '54' '''
  14. cursor.execute(check)
  15. a = cursor.fetchall()
  16. print a
  17.  
  18. except psycopg2.OperationalError:
  19. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement