def read_sales_over_inventory(): table_sales_by_category = Table(connection, q.query_sales_by_movie) table_inventory_by_category = Table(connection, q.query_movie_inventory_by_category) table_inventory_by_category.df.columns = ['category_id', 'name', 'inventory_count'] table_sales_by_category.df['sales_over_inventory'] = \ table_sales_by_category.df['total_sales'] / \ table_inventory_by_category.df['inventory_count'] columns = ['Category', 'Total Sales', 'Sales Over Inventory'] result_json = table_sales_by_category.get_json_rep(columns) return result_json
def read_films_in_inventory_by_store(): table = Table(connection, q.query_films_in_inventory_by_store) columns = ['Store ID', 'Number of Films'] result_json = table.get_json_rep(columns) return result_json
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
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