import psycopg2 from pandas import DataFrame from datetime import datetime, date import collections import re import dataclean as dc import ConfigInfo as cf import sys import traceback import smtplib try: url = cf.l_url start = datetime.now() data = dc.jsonToFrame(url) #Cleaning Data data = dc.cleanData(data) conn = psycopg2.connect("host={0} dbname={1} user={2} password={3} sslmode=allow".format(cf.chartio_host,cf.chartio_db,cf.chartio_id,cf.chartio_pwd)) dc.writeFrame(conn,'pw_lease',data) conn.close() end = datetime.now() print end - start print 'Done' except: exc_type, exc_value, exc_traceback = sys.exc_info()
from pandas import DataFrame from datetime import datetime, date import collections import re import dataclean as dc import sys import traceback import smtplib import ConfigInfo as cf try: #Transaction Data tr_url = cf.tr_url start = datetime.now() tr_data = dc.jsonToFrame(tr_url) #Cleaning Data tr_data = dc.cleanData(tr_data) conn = psycopg2.connect("host={0} dbname={1} user={2} password ={3} sslmode=allow".format(cf.chartio_host,cf.chartio_db,cf.chartio_id,cf.chartio_pwd)) dc.writeFrame(conn,'pw_transaction',tr_data) conn.close() end = datetime.now() print end - start print 'Done' except:
from pandas import DataFrame from datetime import datetime, date import collections import re import dataclean as dc import sys import traceback import smtplib import ConfigInfo as cf try: #Payment Data p_url = cf.p_url start = datetime.now() p_data = dc.jsonToFrame(p_url) #Cleaning Data p_data = dc.cleanData(p_data) conn = psycopg2.connect("host={0} dbname={1} user={2} password ={3} sslmode=allow".format(cf.chartio_host,cf.chartio_db,cf.chartio_id,cf.chartio_pwd)) dc.writeFrame(conn,'pw_payment',p_data) conn.close() end = datetime.now() print end - start print 'Done' except:
from pandas import DataFrame from datetime import datetime, date import collections import re import dataclean as dc import sys import traceback import smtplib import ConfigInfo as cf try: #Charge Data ch_url = cf.ch_url start = datetime.now() ch_data = dc.jsonToFrame(ch_url) #Cleaning Data ch_data = dc.cleanData(ch_data) conn = psycopg2.connect("host={0} dbname={1} user={2} password ={3} sslmode=allow".format(cf.chartio_host,cf.chartio_db,cf.chartio_id,cf.chartio_pwd)) dc.writeFrame(conn,'pw_charge',ch_data) conn.close() end = datetime.now() print end - start print 'Done' except:
from pandas import DataFrame from datetime import datetime, date import collections import re import dataclean as dc import sys import traceback import smtplib import ConfigInfo as cf try: #buildings Data b_url = cf.b_url start = datetime.now() b_data = dc.jsonToFrame(b_url) #Cleaning Data b_data = dc.cleanData(b_data) conn = psycopg2.connect("host={0} dbname={1} user={2} password ={3} sslmode=allow".format(cf.chartio_host,cf.chartio_db,cf.chartio_id,cf.chartio_pwd)) dc.writeFrame(conn,'pw_building',b_data) conn.close() end = datetime.now() print end - start print 'Done' except:
from pandas import DataFrame from datetime import datetime, date import collections import re import dataclean as dc import sys import traceback import smtplib import ConfigInfo as cf try: #Transaction Data ds_url = cf.ds_url start = datetime.now() ds_data = dc.jsonToFrame(ds_url) #Cleaning Data ds_data = dc.cleanData(ds_data) conn = psycopg2.connect("host={0} dbname={1} user={2} password ={3} sslmode=allow".format(cf.chartio_host,cf.chartio_db,cf.chartio_id,cf.chartio_pwd)) dc.writeFrame(conn,'pw_disadjbd',ds_data) conn.close() end = datetime.now() print end - start print 'Done' except: