def deleteentrys(self, entrys): connection = db.engine.connect() trans = connection.begin() try: for entry in entrys: connection.execute(ShoeTable.delete().where(ShoeTable.c.Id == entry.Id)) trans.commit() except Exception, e: trans.rollback()
def addentrys(self, entrys): connection = db.engine.connect() trans = connection.begin() try: for entry in entrys: ins = ShoeTable.insert().values(Id=entry.Id, Title=entry.Title, Url=entry.Url, Number=entry.Number, Price=entry.Price, Popularity=entry.Popularity, UpdateStr=entry.UpdateStr, Market=entry.Market, Sort=entry.Sort) connection.execute(ins) trans.commit() except Exception,e: trans.rollback()
def updateentrys(self, entrys): connection = db.engine.connect() trans = connection.begin() try: for entry in entrys: stmt = ShoeTable.update(). \ where(ShoeTable.c.Id == entry.Id). \ values(Title=entry.Title, Url=entry.Url, Number=entry.Number, Price=entry.Price, Sort=entry.Sort, Popularity=entry.Popularity, UpdateStr=entry.UpdateStr, Market=entry.Market) connection.execute(stmt) trans.commit() except Exception, e: trans.rollback()
def deleteentry(self, entry): connection = db.engine.connect() connection.execute(ShoeTable.delete().where(ShoeTable.c.Id == entry.Id))
def updateentry(self, entry): connection = db.engine.connect() stmt = ShoeTable.update(). \ where(ShoeTable.c.Id == entry.Id). \ values(Title=entry.Title, Url=entry.Url, Number=entry.Number, Price=entry.Price, Popularity=entry.Popularity, UpdateStr=entry.UpdateStr, Market=entry.Market, Sort=entry.Sort) connection.execute(stmt)
def addentry(self, entry): ins = ShoeTable.insert().values(Id=entry.Id, Title=entry.Title, Url=entry.Url, Number=entry.Number, Price=entry.Price, Popularity=entry.Popularity, UpdateStr=entry.UpdateStr, Market=entry.Market, Sort=entry.Sort) conn = db.engine.connect() conn.execute(ins)
def deleteall(self): connection = db.engine.connect() connection.execute(ShoeTable.delete())