def get_default_scheduled_app_params(app_name, serialized=True): session = session_factory() try: fap = session.query(FappModel).filter_by(name=app_name).first() if not fap: return False fap_dict = to_dict(fap) if serialize: return serialize(fap_dict) else: return fap_dict finally: session.close()
def get_default_scheduled_apps(serialized=False): # Get model form DB apps = [] session = session_factory() for f in session.query(FappModel).filter_by(is_scheduled=True).all(): if serialized: apps.append(serialize(to_dict(f))) else: app = to_dict(f) app['default_params'] = json.loads(app['default_params']) apps.append(app) session.close() return apps