Last active
May 20, 2016 19:48
-
-
Save graham-thomson/bad1f8c39172f187d9c06cbd142d794d to your computer and use it in GitHub Desktop.
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
import psycopg2 as pg | |
# import pymysql | |
query = """ | |
SELECT | |
report_campaign_id, | |
SUM(impressions) | |
FROM | |
adobe_data.dat_daily_pivot | |
WHERE | |
segment='ALL' | |
AND sample_start_date = CURRENT_DATE -1 | |
GROUP BY 1 | |
""" | |
conn = pg.connect("host=comcast.digitas.com user=gthomson password=<password> dbname=com_db") | |
cur = conn.cursor() | |
cur.execute(query) | |
results = cur.fetchall() | |
results = [list(row) for row in results] | |
conn.commit() | |
conn.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment