Beispiel #1
0
 def get_all(collection):
     with get_cursor() as cursor:
         if collection == "item":
             cursor.execute(SELECT_ITEMS)
             return cursor.fetchall()
         else:
             cursor.execute(SELECT_ALERTS)
             return cursor.fetchall()
Beispiel #2
0
 def get_one(collection, item_id):
     with get_cursor() as cursor:
         if collection == "item":
             cursor.execute(SELECT_ITEM, item_id)
             return cursor.fetchone()
         else:
             cursor.execute(SELECT_ALERT, item_id)
             return cursor.fetchone()
Beispiel #3
0
 def insert_item(url, tag_name, query):
     with get_cursor() as cursor:
         cursor.execute(INSERT_ITEM, (url, tag_name, Json(query)))
Beispiel #4
0
 def insert_alert(item_id, price_limit):
     with get_cursor() as cursor:
         cursor.execute(INSERT_ALERT, (item_id, price_limit))
Beispiel #5
0
 def create_tables():
     with get_cursor() as cursor:
         cursor.execute(CREATE_ITEMS)