class PV_analysis: def __init__(self, files, db_settings=local_db_settings): self.connection = MySQL_Connection(db_settings) self.data = Market_PV_Counter(files).get_data() def store(self): self.connection.update("T_Site", ["recent_visit_cnt"], ["0"], 'WHERE url != ""') for url, value in self.data.items(): with self.connection.connection as cursor: cursor.execute( 'UPDATE T_Site SET recent_visit_cnt = recent_visit_cnt+%d WHERE url LIKE "%%%s%%"' % (value, url) )
def __init__(self, files, db_settings=local_db_settings): self.connection = MySQL_Connection(db_settings) self.data = Market_PV_Counter(files).get_data()