def product_info(self): with cursor() as cur: cur.execute( "SELECT item.product, brand.name, product.name FROM item, product, brand " "WHERE brand.id=product.brand and item.product=product.id and item.id=%s", (self.id,) ) data = cur.fetchone() dictdata = {"brand": data[1], "product": data[0], "name": data[2]} return dictdata
def items_id(self): with cursor() as cur: cur.execute("SELECT item.id FROM item WHERE item.product=%s", (self.id,)) data = cur.fetchall() return [i[0] for i in data]