Example #1
0
def read_sales_by_employee_over_time():
    table = Table(connection, q.query_rental_by_staff)
    table.df = table.df[['staff_id', 'month(rental_date)', 'total_sales']]
    table.df = table.df.pivot(index='month(rental_date)',
                              columns='staff_id', values='total_sales')
    table.df = table.df.reset_index()
    result_json = table.df.to_json(orient='records')
    return Markup(result_json)
Example #2
0
def read_films_in_inventory_by_category():
    table = Table(connection, q.query_movie_inventory_by_category)
    columns = ['Category', 'Inventory Count']
    table.df = table.df[['name', 'count(*)']]
    result_json = table.get_json_rep(columns)
    return result_json
Example #3
0
def read_sales_last_month_over_time():
    table = Table(connection, q.query_payments_by_date_month)
    table.df = table.df[['day(payment_date)', 'sum(amount)']]
    columns = ['Day', 'Payments']
    result_json = table.get_json_rep(columns)
    return result_json