Last active
April 12, 2017 05:35
-
-
Save theand/d29e8204adb51fe97a226da3f31d3d56 to your computer and use it in GitHub Desktop.
testing pg connection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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