elif a1["command"] == "Get": choices = [Separator("= {} =".format(a2["table"]))] attrs = db.schema_struct[a2["table"]] for i in attrs: choices.append({"name": i}) q4 = [{ "type": "checkbox", "message": "Select attributes you want to display", "name": "getattr", "choices": choices, }] a4 = prompt(q4, style=style) try: columns = json.dumps(a4["getattr"]) s = db.get(a2["table"], columns=columns[1:len(columns) - 1]) puts(colored.green('Query "{}" executed successfully'.format(s))) except Exception as e: puts(colored.red(e)) if a1["command"] in {"Query", "Interactive"}: if a1["command"] == "Interactive": q5 = [{ "type": "input", "name": "function", "message": "Write Any valid python Database function", "validate": lambda text: len(text) != 0 or "Enter a valid function",
else: q9 = [{ "type": "input", "message": "Enter name of the app", "name": "search", "validate": lambda text: len(text) != 0 or "Field can't be empty.", }] a9 = prompt(q9, style=style) s = db.get("app", "appname, appid", where="name='{}'".format(a9["search"]), output=False) apps = db.display_query(s, output=False) if apps == []: puts( colored.red("{} does not exist in database.".format( a9["search"]))) else: apps = dict(apps) for i in apps.keys(): q4[0]["choices"].append({"name": i}) a4 = prompt(q4, style=style) if a4["install"] == []: puts(colored.red("You have to select at least one app.")) else: