{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "WriteQueryDemo.ipynb",
      "provenance": [],
      "collapsed_sections": [],
      "include_colab_link": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "widgets": {
      "application/vnd.jupyter.widget-state+json": {
        "566212477cf74f43a4eb93545eac12ef": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "BoxModel",
          "state": {
            "_view_name": "BoxView",
            "_dom_classes": [],
            "_model_name": "BoxModel",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "box_style": "",
            "layout": "IPY_MODEL_244d7783e0ce472cbf8dc2e8e9bb4c09",
            "_model_module": "@jupyter-widgets/controls",
            "children": [
              "IPY_MODEL_d80fc4f9987f46afb2225eba4c5ca900",
              "IPY_MODEL_feb4cb0880844e7f9a62115c1c41c468",
              "IPY_MODEL_74d83b6bfb9b4b62be4f656244d202a7",
              "IPY_MODEL_999812fc0bf9451db4fc9cfdcbc649d1",
              "IPY_MODEL_d58f5ebedfc649cd94c5a6873e446f06",
              "IPY_MODEL_dc0ed5f49e7149a08b0dad07b60ef8b2"
            ]
          }
        },
        "244d7783e0ce472cbf8dc2e8e9bb4c09": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": "column",
            "width": "30%",
            "min_width": null,
            "border": null,
            "align_items": "stretch",
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": "flex",
            "left": null
          }
        },
        "d80fc4f9987f46afb2225eba4c5ca900": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "BoxModel",
          "state": {
            "_view_name": "BoxView",
            "_dom_classes": [],
            "_model_name": "BoxModel",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "box_style": "",
            "layout": "IPY_MODEL_e73ece1c7e624d618b9ae3ea2d613c40",
            "_model_module": "@jupyter-widgets/controls",
            "children": [
              "IPY_MODEL_d221741fa8e94c79940dcb3b81d0ecfb",
              "IPY_MODEL_bb00b59969ce4563b395b7d363134b22"
            ]
          }
        },
        "feb4cb0880844e7f9a62115c1c41c468": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "BoxModel",
          "state": {
            "_view_name": "BoxView",
            "_dom_classes": [],
            "_model_name": "BoxModel",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "box_style": "",
            "layout": "IPY_MODEL_e73ece1c7e624d618b9ae3ea2d613c40",
            "_model_module": "@jupyter-widgets/controls",
            "children": [
              "IPY_MODEL_02548f84f8fa4660a67b1abb72366891",
              "IPY_MODEL_3c017b2152db4d2ba64b45eeb17f65d3"
            ]
          }
        },
        "74d83b6bfb9b4b62be4f656244d202a7": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "BoxModel",
          "state": {
            "_view_name": "BoxView",
            "_dom_classes": [],
            "_model_name": "BoxModel",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "box_style": "",
            "layout": "IPY_MODEL_e73ece1c7e624d618b9ae3ea2d613c40",
            "_model_module": "@jupyter-widgets/controls",
            "children": [
              "IPY_MODEL_cebb9ca9ce8c44f18479cb4032ea3952",
              "IPY_MODEL_2a1c237af6ed4c6cb637099483fc6d58"
            ]
          }
        },
        "999812fc0bf9451db4fc9cfdcbc649d1": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "BoxModel",
          "state": {
            "_view_name": "BoxView",
            "_dom_classes": [],
            "_model_name": "BoxModel",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "box_style": "",
            "layout": "IPY_MODEL_e73ece1c7e624d618b9ae3ea2d613c40",
            "_model_module": "@jupyter-widgets/controls",
            "children": [
              "IPY_MODEL_0dd14ebdae554275b7353eae2be481db",
              "IPY_MODEL_07c309d2bbca45f7b7baeaceae25fbc0"
            ]
          }
        },
        "d58f5ebedfc649cd94c5a6873e446f06": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "BoxModel",
          "state": {
            "_view_name": "BoxView",
            "_dom_classes": [],
            "_model_name": "BoxModel",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "box_style": "",
            "layout": "IPY_MODEL_e73ece1c7e624d618b9ae3ea2d613c40",
            "_model_module": "@jupyter-widgets/controls",
            "children": [
              "IPY_MODEL_24c6c111e55a42a5aee3a84509fa44c1",
              "IPY_MODEL_c57e567fa6094d97bfed10993000bec6"
            ]
          }
        },
        "dc0ed5f49e7149a08b0dad07b60ef8b2": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "BoxModel",
          "state": {
            "_view_name": "BoxView",
            "_dom_classes": [],
            "_model_name": "BoxModel",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "box_style": "",
            "layout": "IPY_MODEL_e73ece1c7e624d618b9ae3ea2d613c40",
            "_model_module": "@jupyter-widgets/controls",
            "children": [
              "IPY_MODEL_7d73e485d0954123a49fa5b6f6968789"
            ]
          }
        },
        "e73ece1c7e624d618b9ae3ea2d613c40": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": "space-between",
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": "row",
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": "inline-flex",
            "left": null
          }
        },
        "d221741fa8e94c79940dcb3b81d0ecfb": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "LabelModel",
          "state": {
            "_view_name": "LabelView",
            "style": "IPY_MODEL_24eb479e195c45c6b0dbdc0ae66ff15d",
            "_dom_classes": [],
            "description": "",
            "_model_name": "LabelModel",
            "placeholder": "​",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": "Hostname",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_ad4b7ede6c14415ca9853b8f215e4805"
          }
        },
        "bb00b59969ce4563b395b7d363134b22": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "TextModel",
          "state": {
            "_view_name": "TextView",
            "style": "IPY_MODEL_a1e4a84cddcd4b709729939162039839",
            "_dom_classes": [],
            "description": "",
            "_model_name": "TextModel",
            "placeholder": "TigerGraph Hostname (ex: https://tg.i.tgcloud.io)",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": "",
            "_view_count": null,
            "disabled": false,
            "_view_module_version": "1.5.0",
            "continuous_update": true,
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_842e999624334b3da34703096b35e261"
          }
        },
        "02548f84f8fa4660a67b1abb72366891": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "LabelModel",
          "state": {
            "_view_name": "LabelView",
            "style": "IPY_MODEL_d35711e71fa2426b88df098bcc503dff",
            "_dom_classes": [],
            "description": "",
            "_model_name": "LabelModel",
            "placeholder": "​",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": "Graph Name",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_60273c4b22234b31a44a9f53209c0ea8"
          }
        },
        "3c017b2152db4d2ba64b45eeb17f65d3": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "TextModel",
          "state": {
            "_view_name": "TextView",
            "style": "IPY_MODEL_a0610f890bfc49d6b5de82fcace9b6fb",
            "_dom_classes": [],
            "description": "",
            "_model_name": "TextModel",
            "placeholder": "TigerGraph Graph Name",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": "MyGraph",
            "_view_count": null,
            "disabled": false,
            "_view_module_version": "1.5.0",
            "continuous_update": true,
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_79a1482de0db4f6c953a0e7628995a0e"
          }
        },
        "cebb9ca9ce8c44f18479cb4032ea3952": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "LabelModel",
          "state": {
            "_view_name": "LabelView",
            "style": "IPY_MODEL_36185b170c6541d2a5b001249d03725b",
            "_dom_classes": [],
            "description": "",
            "_model_name": "LabelModel",
            "placeholder": "​",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": "Username",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_0d50d60ae1c64d7aaff4f946545aa84d"
          }
        },
        "2a1c237af6ed4c6cb637099483fc6d58": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "TextModel",
          "state": {
            "_view_name": "TextView",
            "style": "IPY_MODEL_98b21e44d934422b851451f5b49577db",
            "_dom_classes": [],
            "description": "",
            "_model_name": "TextModel",
            "placeholder": "TigerGraph Username",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": "tigergraph",
            "_view_count": null,
            "disabled": false,
            "_view_module_version": "1.5.0",
            "continuous_update": true,
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_e03a77a8419e4f7cbf6f75e7ea715763"
          }
        },
        "0dd14ebdae554275b7353eae2be481db": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "LabelModel",
          "state": {
            "_view_name": "LabelView",
            "style": "IPY_MODEL_0ad5b3983f8649c4b10ad8a6ef39ad42",
            "_dom_classes": [],
            "description": "",
            "_model_name": "LabelModel",
            "placeholder": "​",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": "Password",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_cd22f0bfe7a84c399c9cc690544a7c6b"
          }
        },
        "07c309d2bbca45f7b7baeaceae25fbc0": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "TextModel",
          "state": {
            "_view_name": "TextView",
            "style": "IPY_MODEL_0db8763cad594a2d999d1fdf3068024e",
            "_dom_classes": [],
            "description": "",
            "_model_name": "TextModel",
            "placeholder": "TigerGraph Password",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": "",
            "_view_count": null,
            "disabled": false,
            "_view_module_version": "1.5.0",
            "continuous_update": true,
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_10b1e02a14e94afa8efd69796460049b"
          }
        },
        "24c6c111e55a42a5aee3a84509fa44c1": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "LabelModel",
          "state": {
            "_view_name": "LabelView",
            "style": "IPY_MODEL_2e7543716d1243a49ba3c066841c0c75",
            "_dom_classes": [],
            "description": "",
            "_model_name": "LabelModel",
            "placeholder": "​",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": "Cert Needed",
            "_view_count": null,
            "_view_module_version": "1.5.0",
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_b0e195e85ef34eaf83d98ccb8a7b6541"
          }
        },
        "c57e567fa6094d97bfed10993000bec6": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "CheckboxModel",
          "state": {
            "_view_name": "CheckboxView",
            "style": "IPY_MODEL_de682873b3674bb19b6bcd75cd560160",
            "_dom_classes": [],
            "description": "",
            "_model_name": "CheckboxModel",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "value": false,
            "_view_count": null,
            "disabled": false,
            "_view_module_version": "1.5.0",
            "indent": false,
            "description_tooltip": null,
            "_model_module": "@jupyter-widgets/controls",
            "layout": "IPY_MODEL_140a9e3fe35540d08c4b99b7b19519e9"
          }
        },
        "7d73e485d0954123a49fa5b6f6968789": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ButtonModel",
          "state": {
            "_view_name": "ButtonView",
            "style": "IPY_MODEL_b1725874aed24954889229929b363bc5",
            "_dom_classes": [],
            "description": "Connect To TigerGraph",
            "_model_name": "ButtonModel",
            "button_style": "info",
            "_view_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "tooltip": "Click to connect to graph",
            "_view_count": null,
            "disabled": false,
            "_view_module_version": "1.5.0",
            "layout": "IPY_MODEL_369edd5843444f9a982d5ae32c0e778f",
            "_model_module": "@jupyter-widgets/controls",
            "icon": "plug"
          }
        },
        "24eb479e195c45c6b0dbdc0ae66ff15d": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "ad4b7ede6c14415ca9853b8f215e4805": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "a1e4a84cddcd4b709729939162039839": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "842e999624334b3da34703096b35e261": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "d35711e71fa2426b88df098bcc503dff": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "60273c4b22234b31a44a9f53209c0ea8": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "a0610f890bfc49d6b5de82fcace9b6fb": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "79a1482de0db4f6c953a0e7628995a0e": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "36185b170c6541d2a5b001249d03725b": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "0d50d60ae1c64d7aaff4f946545aa84d": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "98b21e44d934422b851451f5b49577db": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "e03a77a8419e4f7cbf6f75e7ea715763": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "0ad5b3983f8649c4b10ad8a6ef39ad42": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "cd22f0bfe7a84c399c9cc690544a7c6b": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "0db8763cad594a2d999d1fdf3068024e": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "10b1e02a14e94afa8efd69796460049b": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "2e7543716d1243a49ba3c066841c0c75": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "b0e195e85ef34eaf83d98ccb8a7b6541": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "de682873b3674bb19b6bcd75cd560160": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "DescriptionStyleModel",
            "description_width": "",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "140a9e3fe35540d08c4b99b7b19519e9": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "b1725874aed24954889229929b363bc5": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ButtonStyleModel",
          "state": {
            "_view_name": "StyleView",
            "_model_name": "ButtonStyleModel",
            "_view_module": "@jupyter-widgets/base",
            "_model_module_version": "1.5.0",
            "_view_count": null,
            "button_color": null,
            "font_weight": "",
            "_view_module_version": "1.2.0",
            "_model_module": "@jupyter-widgets/controls"
          }
        },
        "369edd5843444f9a982d5ae32c0e778f": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": "100%",
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        },
        "d74c7dbefba04592b2719d1ff5cc23bb": {
          "model_module": "@jupyter-widgets/output",
          "model_name": "OutputModel",
          "state": {
            "_view_name": "OutputView",
            "msg_id": "",
            "_dom_classes": [],
            "_model_name": "OutputModel",
            "outputs": [],
            "_view_module": "@jupyter-widgets/output",
            "_model_module_version": "1.0.0",
            "_view_count": null,
            "_view_module_version": "1.0.0",
            "layout": "IPY_MODEL_67b3b87bf58241dba13760fbf50c0fc4",
            "_model_module": "@jupyter-widgets/output"
          }
        },
        "67b3b87bf58241dba13760fbf50c0fc4": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "state": {
            "_view_name": "LayoutView",
            "grid_template_rows": null,
            "right": null,
            "justify_content": null,
            "_view_module": "@jupyter-widgets/base",
            "overflow": null,
            "_model_module_version": "1.2.0",
            "_view_count": null,
            "flex_flow": null,
            "width": null,
            "min_width": null,
            "border": null,
            "align_items": null,
            "bottom": null,
            "_model_module": "@jupyter-widgets/base",
            "top": null,
            "grid_column": null,
            "overflow_y": null,
            "overflow_x": null,
            "grid_auto_flow": null,
            "grid_area": null,
            "grid_template_columns": null,
            "flex": null,
            "_model_name": "LayoutModel",
            "justify_items": null,
            "grid_row": null,
            "max_height": null,
            "align_content": null,
            "visibility": null,
            "align_self": null,
            "height": null,
            "min_height": null,
            "padding": null,
            "grid_auto_rows": null,
            "grid_gap": null,
            "max_width": null,
            "order": null,
            "_view_module_version": "1.2.0",
            "grid_template_areas": null,
            "object_position": null,
            "object_fit": null,
            "grid_auto_columns": null,
            "margin": null,
            "display": null,
            "left": null
          }
        }
      }
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/akash-kaul/ecosys/blob/master/WriteQueryDemo.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "oW2EzGvfpiLg",
        "colab_type": "code",
        "cellView": "both",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 209,
          "referenced_widgets": [
            "566212477cf74f43a4eb93545eac12ef",
            "244d7783e0ce472cbf8dc2e8e9bb4c09",
            "d80fc4f9987f46afb2225eba4c5ca900",
            "feb4cb0880844e7f9a62115c1c41c468",
            "74d83b6bfb9b4b62be4f656244d202a7",
            "999812fc0bf9451db4fc9cfdcbc649d1",
            "d58f5ebedfc649cd94c5a6873e446f06",
            "dc0ed5f49e7149a08b0dad07b60ef8b2",
            "e73ece1c7e624d618b9ae3ea2d613c40",
            "d221741fa8e94c79940dcb3b81d0ecfb",
            "bb00b59969ce4563b395b7d363134b22",
            "02548f84f8fa4660a67b1abb72366891",
            "3c017b2152db4d2ba64b45eeb17f65d3",
            "cebb9ca9ce8c44f18479cb4032ea3952",
            "2a1c237af6ed4c6cb637099483fc6d58",
            "0dd14ebdae554275b7353eae2be481db",
            "07c309d2bbca45f7b7baeaceae25fbc0",
            "24c6c111e55a42a5aee3a84509fa44c1",
            "c57e567fa6094d97bfed10993000bec6",
            "7d73e485d0954123a49fa5b6f6968789",
            "24eb479e195c45c6b0dbdc0ae66ff15d",
            "ad4b7ede6c14415ca9853b8f215e4805",
            "a1e4a84cddcd4b709729939162039839",
            "842e999624334b3da34703096b35e261",
            "d35711e71fa2426b88df098bcc503dff",
            "60273c4b22234b31a44a9f53209c0ea8",
            "a0610f890bfc49d6b5de82fcace9b6fb",
            "79a1482de0db4f6c953a0e7628995a0e",
            "36185b170c6541d2a5b001249d03725b",
            "0d50d60ae1c64d7aaff4f946545aa84d",
            "98b21e44d934422b851451f5b49577db",
            "e03a77a8419e4f7cbf6f75e7ea715763",
            "0ad5b3983f8649c4b10ad8a6ef39ad42",
            "cd22f0bfe7a84c399c9cc690544a7c6b",
            "0db8763cad594a2d999d1fdf3068024e",
            "10b1e02a14e94afa8efd69796460049b",
            "2e7543716d1243a49ba3c066841c0c75",
            "b0e195e85ef34eaf83d98ccb8a7b6541",
            "de682873b3674bb19b6bcd75cd560160",
            "140a9e3fe35540d08c4b99b7b19519e9",
            "b1725874aed24954889229929b363bc5",
            "369edd5843444f9a982d5ae32c0e778f",
            "d74c7dbefba04592b2719d1ff5cc23bb",
            "67b3b87bf58241dba13760fbf50c0fc4"
          ]
        },
        "outputId": "ad2d0498-8c0f-42e4-8778-1fd284a3f7c0"
      },
      "source": [
        "#@title\n",
        "from ipywidgets import interact, interactive, fixed, interact_manual, widgets, Layout\n",
        "from IPython.display import display, HTML\n",
        "from IPython.utils import io\n",
        "from tqdm import tqdm\n",
        "from ipywidgets.widgets import VBox, HBox, Box, Label\n",
        "import time\n",
        "from glob import glob\n",
        "import requests\n",
        "from functools import wraps\n",
        "import re\n",
        "display(HTML('<link rel=\"stylesheet\" href=\"//stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css\"/>'))\n",
        "out = widgets.Output()\n",
        "form_item_layout = Layout(\n",
        "    display='inline-flex',\n",
        "    flex_flow='row',\n",
        "    justify_content='space-between'\n",
        ")\n",
        "hostname = widgets.Text(\n",
        "    value='',\n",
        "    placeholder='TigerGraph Hostname (ex: https://tg.i.tgcloud.io)',\n",
        "    # description='Hostname',\n",
        "    disabled=False\n",
        ")\n",
        "username = widgets.Text(\n",
        "    value='tigergraph',\n",
        "    placeholder='TigerGraph Username',\n",
        "    # description='Username',\n",
        "    disabled=False\n",
        ")\n",
        "\n",
        "password = widgets.Text(\n",
        "    value='',\n",
        "    placeholder='TigerGraph Password',\n",
        "    # description='Password',\n",
        "    disabled=False,\n",
        ")\n",
        "\n",
        "graphname = widgets.Text(\n",
        "    value = 'MyGraph',\n",
        "    placeholder='TigerGraph Graph Name',\n",
        "    disabled=False,\n",
        ")\n",
        "\n",
        "# Create a dropdown for GSQL version\n",
        "version = widgets.Dropdown(\n",
        "    options=[\"2.6.2\", \"3.0.0\", \"3.0.5\"],\n",
        "    value=\"2.6.2\",\n",
        "    disabled=False,\n",
        ")\n",
        "\n",
        "cert = widgets.Checkbox(\n",
        "    value=False,\n",
        "    # description='Cert Needed',\n",
        "    disabled=False,\n",
        "    indent=False\n",
        ")\n",
        "connect = widgets.Button(\n",
        "    description='Connect To TigerGraph',\n",
        "    disabled=False,\n",
        "    button_style='info', # 'success', 'info', 'warning', 'danger' or ''\n",
        "    tooltip='Click to connect to graph',\n",
        "    icon='plug', # (FontAwesome names without the `fa-` prefix)\n",
        "    layout=Layout(width='100%')\n",
        ")\n",
        "error = widgets.Label(\n",
        "    value='Something went wrong!! Make sure your server is live and your information is entered correctly',\n",
        "    disabled=False,\n",
        "    layout=Layout(width='50%')\n",
        "\n",
        ")\n",
        "click_cancel = widgets.Button(\n",
        "    description = 'No',\n",
        "    disabled=False,\n",
        "    button_style='danger',\n",
        "    icon='ban',\n",
        "    layout=Layout(width='50%')\n",
        ")\n",
        "click_continue = widgets.Button(\n",
        "    description = 'Yes',\n",
        "    disabled=False,\n",
        "    button_style='success',\n",
        "    icon='arrow-circle-right',\n",
        "    layout=Layout(width='50%')\n",
        ")\n",
        "loading = widgets.Label(\n",
        "            value=f'Query installing. This may take a minute...',\n",
        "            disabled=False,\n",
        "            layout=Layout(width='50%')\n",
        "            )\n",
        "form_items = [\n",
        "    Box([Label(value='Hostname'), hostname], layout=form_item_layout),\n",
        "    Box([Label(value='Graph Name'), graphname], layout=form_item_layout),\n",
        "    Box([Label(value='Username'), username], layout=form_item_layout),\n",
        "    Box([Label(value='Password'), password], layout=form_item_layout),\n",
        "    Box([Label(value='Cert Needed'), cert], layout=form_item_layout),\n",
        "    Box([Label(value='Client Version'), version], layout=form_item_layout),\n",
        "    Box([connect], layout=form_item_layout)\n",
        "]\n",
        "\n",
        "def connectToGraph(b):\n",
        "    with tqdm(total=100, leave=False) as pbar: # Controlling output on display\n",
        "        out.clear_output()\n",
        "        pbar.bar_format=\"{percentage:3.0f}%|{bar:10}|{desc}\" #\n",
        "        connect.icon='spinner'\n",
        "        connect.description='Loading'\n",
        "        connect.button_style='warning'\n",
        "        #--pyTigerGraph_BEGIN--#\n",
        "        pbar.set_description_str('Installing pyTigerGraph')\n",
        "        with io.capture_output() as captured:\n",
        "            !pip install pytigergraph\n",
        "            import pyTigerGraph as tg\n",
        "        pbar.update(20)\n",
        "        #--pyTigerGraph_END--#\n",
        "\n",
        "        #--Establish_Connection_BEGIN--#\n",
        "        pbar.set_description_str('Connecting to Server')\n",
        "        try:\n",
        "            with io.capture_output() as captured:\n",
        "                graph = tg.TigerGraphConnection(host=hostname.value, username=username.value, password=password.value, graphname=graphname.value, useCert=cert.value, verison=version.value)\n",
        "        except Exception as e:\n",
        "            pbar.close()\n",
        "            out.clear_output()\n",
        "            with out:\n",
        "                display(error)\n",
        "                connect.icon='plug'\n",
        "                connect.description='Connect to TigerGraph'\n",
        "                connect.button_style='info'\n",
        "            return\n",
        "        pbar.update(20)\n",
        "        with io.capture_output() as captured:\n",
        "            API_Secret = graph.createSecret()\n",
        "            API_Token = graph.getToken(API_Secret, setToken=True, lifetime=None)[0]\n",
        "            pbar.update(10)\n",
        "        #--Establish_Connection_END--#\n",
        "\n",
        "        #--Installing_Methods_BEGIN--#\n",
        "        pbar.set_description_str('Adding Notebook Functions')\n",
        "        def get_query(x):\n",
        "          text = graph.gsql(f'show query {x}')\n",
        "          if 'CREATE QUERY' in text:\n",
        "            q_name = text.find('CREATE QUERY')\n",
        "            query_text = text[q_name:]          \n",
        "          return query_text\n",
        "        pbar.update(10)\n",
        "        #--Installing_Methods_END-#   \n",
        "        #--Grab_Queries_BEGIN-#      \n",
        "        pbar.set_description_str('Fetching Graph Queries')\n",
        "        with io.capture_output() as captured:  \n",
        "            ls = graph.gsql('ls')\n",
        "        pbar.update(10)\n",
        "        query = ls.find('Queries:')\n",
        "        pbar.update(10)\n",
        "        queries = {}\n",
        "        for line in ls[query:].splitlines():\n",
        "            if '-' in line:\n",
        "                start = line.find('-') + 2\n",
        "                end = line.find('(')\n",
        "                name = line[start:end]\n",
        "                queries[name] = get_query(name)\n",
        "        \n",
        "        pbar.set_description_str('Information Retrieved')               \n",
        "        pbar.update(10)\n",
        "\n",
        "        #Place queries in dropdown widget\n",
        "        dropdown = widgets.Dropdown(\n",
        "            options=queries.keys(),\n",
        "            layout=Layout(width='450px'),\n",
        "            disabled=False,\n",
        "            )\n",
        "        pbar.update(10)\n",
        "        pbar.set_description_str(' Connection sucessful')\n",
        "        connect.icon='check-circle'\n",
        "        connect.description='Success'\n",
        "        connect.button_style='success'\n",
        "        time.sleep(1)\n",
        "        pbar.close()\n",
        "        username.disabled=True\n",
        "        password.disabled=True\n",
        "        hostname.disabled=True\n",
        "        cert.disabled=True\n",
        "        connect.disabled=True  \n",
        "        graphname.disabled=True\n",
        "        version.disabled=True\n",
        "    x = queries[dropdown.value]\n",
        "    text = widgets.Textarea(\n",
        "        value=x,\n",
        "        disabled=False,\n",
        "        layout=Layout(height='400px', width='450px')\n",
        "        )\n",
        "    confirm = widgets.Button(\n",
        "            description='Install Query',\n",
        "            icon='cloud-upload',\n",
        "            disabled=False,\n",
        "            button_style='info',\n",
        "            layout=Layout(width='100%'),\n",
        "            )\n",
        "    form_items2 = [\n",
        "        Box([Label(value='Queries'), dropdown], layout=form_item_layout),\n",
        "        Box([Label(value='GSQL Script'), text], layout=form_item_layout),\n",
        "        Box([confirm], layout=form_item_layout),\n",
        "    ]\n",
        "    form2 = Box(form_items2, layout=Layout(\n",
        "        display='flex',\n",
        "        flex_flow='column',\n",
        "        align_items='stretch',\n",
        "        width='30%'\n",
        "    ))\n",
        "    out2 = widgets.Output()\n",
        "    display(form2, out2)\n",
        "\n",
        "    def on_change(change):\n",
        "        out2.clear_output()\n",
        "        text.value = queries[change.new]\n",
        "        confirm.icon='cloud-upload'\n",
        "        confirm.description='Install Query'\n",
        "        confirm.button_style='info'\n",
        "    def install(b):\n",
        "        confirm.icon='spinner'\n",
        "        confirm.description='Loading'\n",
        "        confirm.button_style='warning'\n",
        "        with out2:\n",
        "            display(loading)\n",
        "        Gsql_query = text.value + 'INSTALL QUERY ' + dropdown.value\n",
        "        with io.capture_output() as captured:\n",
        "            graph.gsql(f'drop query {dropdown.value}')\n",
        "            graph.gsql(Gsql_query)\n",
        "        confirm.icon='check-circle'\n",
        "        confirm.description='Success'\n",
        "        confirm.button_style='success'\n",
        "        out2.clear_output()\n",
        "        forming = [\n",
        "            Box([Label(value='Query Successfully Installed. Would you like to install another one?')], layout=form_item_layout),\n",
        "            Box([click_cancel, click_continue], layout=form_item_layout),\n",
        "            ]   \n",
        "        former = Box(forming, layout=Layout(\n",
        "                display='flex',\n",
        "                flex_flow='column',\n",
        "                align_items='stretch',\n",
        "                width='30%'\n",
        "            ))\n",
        "        with out2:\n",
        "            display(former)\n",
        "        track = None\n",
        "        def yield_for_change(widget, attribute):\n",
        "            def f(iterator):\n",
        "                @wraps(iterator)\n",
        "                def inner():\n",
        "                    i = iterator()\n",
        "                    def next_i(change):\n",
        "                        try:\n",
        "                            i.send(change)\n",
        "                        except StopIteration as e:\n",
        "                            widget.unobserve(next_i, attribute)\n",
        "                    widget.on_click(next_i)\n",
        "                    next(i)\n",
        "                return inner\n",
        "            return f\n",
        "        @yield_for_change(click_cancel, 'value')\n",
        "        def f():\n",
        "            for i in range(1):\n",
        "                x=yield\n",
        "                confirm.icon='cloud-upload'\n",
        "                confirm.description='Install Demo'\n",
        "                confirm.button_style='info'\n",
        "                text.disabled = True\n",
        "                dropdown.disabled = True\n",
        "                confirm.disabled = True\n",
        "                out2.clear_output()\n",
        "                track = False\n",
        "        @yield_for_change(click_continue, 'value')\n",
        "        def g():\n",
        "            for i in range(1):\n",
        "                x=yield\n",
        "                out2.clear_output()\n",
        "        f()\n",
        "        g()\n",
        "        if track is not None:\n",
        "            return\n",
        "    \n",
        "    dropdown.observe(on_change, 'value')\n",
        "    confirm.on_click(install)\n",
        "\n",
        "connect.on_click(connectToGraph)\n",
        "form = Box(form_items, layout=Layout(\n",
        "    display='flex',\n",
        "    flex_flow='column',\n",
        "    align_items='stretch',\n",
        "    width='30%'\n",
        "))\n",
        "display(form, out)"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/html": [
              "<link rel=\"stylesheet\" href=\"//stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css\"/>"
            ],
            "text/plain": [
              "<IPython.core.display.HTML object>"
            ]
          },
          "metadata": {
            "tags": []
          }
        },
        {
          "output_type": "display_data",
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "566212477cf74f43a4eb93545eac12ef",
              "version_minor": 0,
              "version_major": 2
            },
            "text/plain": [
              "Box(children=(Box(children=(Label(value='Hostname'), Text(value='', placeholder='TigerGraph Hostname (ex: http…"
            ]
          },
          "metadata": {
            "tags": []
          }
        },
        {
          "output_type": "display_data",
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "d74c7dbefba04592b2719d1ff5cc23bb",
              "version_minor": 0,
              "version_major": 2
            },
            "text/plain": [
              "Output()"
            ]
          },
          "metadata": {
            "tags": []
          }
        }
      ]
    }
  ]
}