def insert(self): try: sql = 'INSERT INTO {} ({}) VALUES ({})'.format(ItemStats.db_table, self.tuple_keys, self.q_marks) last_row_id = mutation(sql, ( self.id, self.item_id, self.min_price, self.max_price, self.avg_price, self.last_price, self.last_delta, self.last_date, self.last_time, self.count_min_price, self.great_deal)).lastrowid except IntegrityError: sql = 'UPDATE item_stats SET min_price = %s, max_price = %s, avg_price = %s, last_price = %s, last_delta = %s, last_date = %s, last_time = %s, count_min_price = %s, great_deal = %s WHERE item_id = %s' last_row_id = mutation(sql, (self.min_price, self.max_price, self.avg_price, self.last_price, self.last_delta, self.last_date, self.last_time, self.count_min_price, self.great_deal, self.item_id)).lastrowid finally: return last_row_id
def insert(self): sql = 'INSERT INTO {} ({}) VALUES ({})'.format(Category.db_table, self.tuple_keys, self.q_marks) last_row_id = mutation(sql, ( self.id, self.category, )).lastrowid return last_row_id
def insert(self): sql = 'INSERT INTO {} ({}) VALUES ({})'.format(ItemImage.db_table, self.tuple_keys, self.q_marks) last_row_id = mutation(sql, ( self.id, self.item_id, self.image_src, )).lastrowid return last_row_id
def insert(self): sql = 'INSERT INTO {} ({}) VALUES ({})'.format(Store.db_table, self.tuple_keys, self.q_marks) last_row_id = mutation(sql, ( self.id, self.store, self.url, self.logo, )).lastrowid return last_row_id
def delete(self): sql = "DELETE FROM {} WHERE id=%s".format(ItemImage.db_table) return mutation(sql, (self.id, ))
def delete_by_item_id(item_image_id): sql = "DELETE FROM {} WHERE item_id=%s".format(ItemImage.db_table) return mutation(sql, (item_image_id, ))
def insert(self): sql = 'INSERT INTO {} ({}) VALUES ({})'.format(ItemPrice.db_table, self.tuple_keys, self.q_marks) last_row_id = mutation(sql, (self.id, self.date, self.time, self.item_id, self.price, self.delta,)).lastrowid return last_row_id
def delete_by_id(store_id): sql = "DELETE FROM {} WHERE id=%s".format(Store.db_table) return mutation(sql, (store_id, ))
def insert(self): sql = 'INSERT INTO {} ({}) VALUES ({})'.format(Item.db_table, self.tuple_keys, self.q_marks) last_row_id = mutation(sql, (self.id, self.store_id, self.store_product_id, self.title, self.url)).lastrowid return last_row_id
def update_lc_date_time(self, date, time): sql = 'UPDATE {} SET lc_date=%s, lc_time=%s WHERE id=%s'.format(StoreURL.db_table) mutation(sql, (date, time, self.id,))