Skip to content

Instantly share code, notes, and snippets.

@theand
Last active April 12, 2017 05:35
Show Gist options
  • Save theand/d29e8204adb51fe97a226da3f31d3d56 to your computer and use it in GitHub Desktop.
Save theand/d29e8204adb51fe97a226da3f31d3d56 to your computer and use it in GitHub Desktop.
testing pg connection
#!/usr/bin/python
#
import psycopg2
try:
db = psycopg2.connect("dbname='xxx' user='xxx' host='xxx' port='xxx' password='xxx'")
cur = db.cursor()
cur.execute("select current_timestamp")
print cur.fetchone()
except Exception as inst:
print(inst)
exit(1)
exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment