def select_all_from(table_name, limit = -1): query = '' if limit != -1: query = "SELECT * FROM {} LIMIT {}".format(table_name, limit) else: query = "SELECT * FROM {}".format(table_name) print(query) return session.execute(query)
def get_and_store_login_data(selected_month): rows = session.execute(admin_queries["logins_over_time"], [selected_month]) df = DataFrame(rows) jsonified_data = df.to_json(date_format="iso") hidden_data_div = html.Div(id="jsonified-login-df", children=jsonified_data, style={"display": "none"}) graph = dcc.Graph(id="user_activity_graph") return [hidden_data_div, graph]
def get_and_store_usage_data(selected_month): rows = session.execute(admin_queries['data_usage_by_month'], [selected_month]) df = DataFrame(rows) jsonified_data = df.to_json(date_format='iso') hidden_data_div = html.Div(id='jsonified-data-usage-df', children=jsonified_data, style={'display' : 'none'}) graph=dcc.Graph(id='data_usage_graph') return [hidden_data_div, graph]
def get_and_store_login_data(selected_month): rows = session.execute(admin_queries['logins_over_time'], [selected_month]) df = DataFrame(rows) jsonified_data = df.to_json(date_format='iso') hidden_data_div = html.Div(id='jsonified-login-df', children=jsonified_data, style={'display': 'none'}) graph=dcc.Graph(id='user_activity_graph') return [hidden_data_div, graph]
def get_and_store_usage_data(selected_month): rows = session.execute(admin_queries["data_usage_by_month"], [selected_month]) df = DataFrame(rows) jsonified_data = df.to_json(date_format="iso") hidden_data_div = html.Div(id="jsonified-data-usage-df", children=jsonified_data, style={"display": "none"}) graph = dcc.Graph(id="data_usage_graph") return [hidden_data_div, graph]
def get_and_store_usage_data(selected_month): rows = session.execute(admin_queries['data_usage_by_month'], [selected_month]) df = DataFrame(rows) return df.to_json(date_format='iso')
def get_and_store_login_data(selected_month): rows = session.execute(admin_queries['logins_over_time'], [selected_month]) df = DataFrame(rows) return df.to_json(date_format='iso')
def make_queries_get_df (query): rows = session.execute(query) return to_df(rows)
def make_queries_get_df(query): rows = session.execute(query, timeout=None) return to_df(rows)