Example #1
0
        q3 = []
        attrs = db.schema_struct[a2["table"]]
        for attr in attrs:
            q3.append({
                "type":
                "input",
                "message":
                "Enter {} ({})".format(attr, attrs[attr]["type"]),
                "name":
                attr,
            })
        a3 = prompt(q3, style=style)
        try:
            for i, j in a3.items():
                a3[i] = convert(attrs[i]["type"], j)
            s = db.insert(a2["table"], **a3)
            puts(colored.green('Query "{}" executed successfully'.format(s)))
        except Exception as e:
            puts(colored.red(e))

    elif a1["command"] == "Delete":
        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 for compare condition",
            "name": "delattr",
            "choices": choices,
        }]