def retrieve_transactions():
    sql = """
        SELECT *
         FROM  Collector_log
         WHERE event = 'buy'
         ORDER BY session_id, content_id
    """
    cursor = DataHelper.get_query_cursor(sql)
    data = DataHelper.dictfetchall(cursor)

    return data
示例#2
0
def retrieve_transactions():
    sql = """
        SELECT *
         FROM  Collector_log
         WHERE event = 'buy'
         ORDER BY session_id, content_id
    """
    cursor = DataHelper.get_query_cursor(sql)
    data = DataHelper.dictfetchall(cursor)

    return data
示例#3
0
def chart(request, take=10):
    sql = """SELECT content_id,
                mov.title,
                count(*) as sold
            FROM    collector_log log
            JOIN    moviegeeks_movie mov
            ON      log.content_id = mov.movie_id
            WHERE 	event like 'buy'
            GROUP BY content_id, mov.title
            ORDER BY sold desc
            LIMIT {}
            """.format(take)

    c = DataHelper.get_query_cursor(sql)
    data = DataHelper.dictfetchall(c)

    return JsonResponse(data, safe=False)
示例#4
0
def chart(request, take=10):
    sql = """SELECT content_id,
                mov.title,
                count(*) as sold
            FROM    collector_log log
            JOIN    moviegeeks_movie mov
            ON      log.content_id = mov.movie_id
            WHERE 	event like 'buy'
            GROUP BY content_id, mov.title
            ORDER BY sold desc
            LIMIT {}
            """.format(take)

    c = DataHelper.get_query_cursor(sql)
    data = DataHelper.dictfetchall(c)

    return JsonResponse(data, safe=False)