예제 #1
0
def api():
    conn = createConn()
    conn.row_factory = dictFactory
    cur = conn.cursor()
    allData = cur.execute(
        'select * from (select distinct name, terjual,rating, harga, urldetail from bukalapak where rating > 3 order by terjual desc) limit 100'
    ).fetchall()

    return jsonify(allData)
예제 #2
0
 def saveData(self):
     today = date.today()
     conn = createConn()
     conn.execute(
         '''insert into bukalapak(name, harga, rating, terjual, getDate, urldetail) values(?, ?, ?, ?, ?, ?)''',
         (self.name, self.harga, self.rating, self.terjual, today,
          self.urlDetail))
     conn.commit()
     print("berhasil simpan " + self.name)
     conn.close()
예제 #3
0
 def showAll():
     conn = createConn()
     conn.row_factory = sqlite3.Row
     c = conn.cursor()
     c.execute(
         '''select * from (select distinct productName, productSold, productRating, productPrice, productURL from tokopedia where productRating > 3 order by productSold desc) limit 40'''
     )
     # c.execute('''select * from (select * from bukalapak where rating > 3 order by terjual desc) limit 20''')
     results = c.fetchall()
     conn.close()
     return results
예제 #4
0
 def saveData(self):
     today = date.today()
     conn = createConn()
     conn.execute(
         '''insert into tokopedia(productURL, productId, productName, productImage, productRating, productSold, productPrice, getDate) values(?, ?, ?, ?, ?, ?, ?, ?)''',
         (self.productURL, self.productId, self.productName,
          self.productImage, self.productRating, self.productSold,
          self.productPrice, today))
     conn.commit()
     print("berhasil simpan " + self.productName)
     conn.close()
예제 #5
0
 def showAll():
     conn = createConn()
     conn.row_factory = sqlite3.Row
     c = conn.cursor()
     c.execute(
         '''select * from (select distinct name, terjual,rating, harga, urldetail from bukalapak where rating > 3 order by terjual desc) limit 40'''
     )
     # c.execute('''select * from (select * from bukalapak where rating > 3 order by terjual desc) limit 20''')
     results = c.fetchall()
     conn.close()
     return results