Created
November 14, 2014 07:30
-
-
Save haradreborn/1d72c294ac22086a0d3b to your computer and use it in GitHub Desktop.
fetch rows from postgresql
This file contains 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
try: | |
conn_string = "host='106.109.7.91' dbname='smarttvanalyzer' user='samson' password='samson'" | |
conn = psycopg2.connect(conn_string) | |
cursor = conn.cursor() | |
cursor.execute("""SELECT * FROM "IMS" WHERE CAST(date AS DATE) = '""" + ts + "'") | |
rows = cursor.fetchall() | |
conn.commit() | |
for row in rows: | |
print(row) | |
except Exception: | |
print(traceback.format_exc()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment