Skip to content

Commit

Permalink
Merge pull request #254 from vertica/queyr_profiler_upgrade_2
Browse files Browse the repository at this point in the history
Added navigation buttons + updating verticapy using a button
  • Loading branch information
mail4umar authored May 13, 2024
2 parents f39b763 + 2c92ceb commit 6faa749
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 183 deletions.
265 changes: 82 additions & 183 deletions project/ui/conn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,46 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "646eaee7-3870-4fee-af2a-3e2df937d88c",
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"from IPython.display import display, HTML\n",
"\n",
"# Define the URLs for the links\n",
"url1 = \"/lab/\"\n",
"url2 = \"/voila/render/ui/qprof_main.ipynb\"\n",
"\n",
"# Define the button labels\n",
"button_label1 = \"Go to Home Page\"\n",
"button_label2 = \"Go to Query Profiler\"\n",
"\n",
"# Define HTML links for buttons\n",
"button_html1 = f\"<a href='{url1}' style='text-decoration: none; padding: 8px; background-color: #007bff; color: white; border-radius: 5px; margin-right: 10px;'><i class='fa fa-home'></i></a>\"\n",
"button_html2 = f\"<a href='{url2}' style='text-decoration: none; padding: 8px; background-color: #007bff; color: white; border-radius: 5px;'>{button_label2}</a>\"\n",
"\n",
"\n",
"# Create HTML widgets\n",
"html_button1 = widgets.HTML(value=button_html1)\n",
"html_button2 = widgets.HTML(value=button_html2)\n",
"\n",
"# Display buttons\n",
"display(widgets.HBox([html_button1, html_button2]))\n"
]
},
{
"cell_type": "markdown",
"id": "6537d006-71a5-45ae-b6d9-032a4b2879e9",
"metadata": {},
"source": [
"_________"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "739353e9-44cd-4dbb-8891-f1dea998067f",
"metadata": {},
"outputs": [],
Expand All @@ -16,7 +55,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "8ed8016c-dacf-437d-af27-7005b66f6739",
"metadata": {},
"outputs": [],
Expand All @@ -41,25 +80,10 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "1cdf1aa6-6310-4764-823c-c0aff71e396a",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "09fd8c1943344c58ade9173242e7e43f",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(Text(value='', description='Host', placeholder=\"Enter Host (default is 'verticadb')\"), Text(val…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"\n",
Expand All @@ -75,39 +99,10 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "a70eb307-19eb-4ecd-866f-54864d981032",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ec3f62d585ee463da4c13e30b491b62d",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Button(description='Create a Connection', style=ButtonStyle())"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "62eeee9a4c154b7fa341937bb05bb531",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output(layout=Layout(border_bottom='1px solid black', border_left='1px solid black', border_right='1px solid b…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"\n",
"button = widgets.Button(description=\"Create a Connection\")\n",
Expand Down Expand Up @@ -146,53 +141,10 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"id": "074edcaf-2212-4dbf-9d3e-0b430ef514ac",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "0a1d68d3a20e4c09a2bde924745e8504",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Dropdown(description='Available Coneections:', layout=Layout(width='300px'), options=('Yuanzhe', 'VerticaDSN')…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9821d701390645ae98d18fdd9bd8784c",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Button(description='Create a Connection', style=ButtonStyle())"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "5eaf0e2b73004f838a77404fa4be150f",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output(layout=Layout(border_bottom='1px solid black', border_left='1px solid black', border_right='1px solid b…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"from verticapy.connection import change_auto_connection\n",
"\n",
Expand All @@ -215,76 +167,9 @@
"button_select.on_click(on_button_clicked_select)"
]
},
{
"cell_type": "markdown",
"id": "b3ef9cd5-0769-4586-98f1-0f460a22ff1c",
"metadata": {},
"source": [
"____"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "14e6b51c-72d8-4611-b991-47f9aeaa1473",
"metadata": {
"collapsed": true,
"jupyter": {
"outputs_hidden": true
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "1d01048d0ffd4a88a33456ba7a857415",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(HTML(value=\"<a href='http://127.0.0.1:8889/lab/workspaces/auto-3' style='text-decoration: none;…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import ipywidgets as widgets\n",
"from IPython.display import display, HTML\n",
"\n",
"# Define the URLs for the links\n",
"url1 = \"/lab/\"\n",
"url2 = \"/voila/render/ui/qprof_main.ipynb\"\n",
"\n",
"# Define the button labels\n",
"button_label1 = \"Go to Home Page\"\n",
"button_label2 = \"Go to Query Profiler\"\n",
"\n",
"# Define HTML links for buttons\n",
"button_html1 = f\"<a href='{url1}' style='text-decoration: none; padding: 10px; background-color: #007bff; color: white; border-radius: 5px; margin-right: 10px;'><i class='fa fa-home'></i></a>\"\n",
"button_html2 = f\"<a href='{url2}' style='text-decoration: none; padding: 10px; background-color: #007bff; color: white; border-radius: 5px;'>{button_label2}</a>\"\n",
"\n",
"\n",
"# Create HTML widgets\n",
"html_button1 = widgets.HTML(value=button_html1)\n",
"html_button2 = widgets.HTML(value=button_html2)\n",
"\n",
"# Display buttons\n",
"display(widgets.HBox([html_button1, html_button2]))\n"
]
},
{
"cell_type": "markdown",
"id": "32f3c37b-1446-4114-99a0-8dc62998ac5d",
"metadata": {},
"source": [
"____"
]
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": null,
"id": "dd19b4c5-f99f-4467-b885-3cc34a58a7ae",
"metadata": {},
"outputs": [],
Expand All @@ -306,38 +191,52 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": null,
"id": "db3e615b-7ed6-4b14-a508-432a0e6735a5",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2100538297184c6494d87fa467acb6f5",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Accordion(children=(VBox(children=(Button(description='Click to display', style=ButtonStyle()), Output(outputs…"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"accordion = widgets.Accordion(children=[version_details], titles=('Version Details',))\n",
"accordion"
]
},
{
"cell_type": "markdown",
"id": "b295fdd4-b6c3-4749-a639-d9a589e1d46b",
"metadata": {},
"source": [
"_________"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c7e6ed2f-af31-48a8-80fc-f5a9402647b4",
"metadata": {},
"outputs": [],
"source": []
"source": [
"import subprocess\n",
"output_install = widgets.Output()\n",
"\n",
"def install_verticapy(_):\n",
" with output_install:\n",
" subprocess.run([\"pip\", \"install\", \"git+https://github.com/vertica/VerticaPy.git@master\"])\n",
" print(\"Successfully installed latest verticapy from the master branch.\")\n",
" print(\"Note: You must refresh to get the latest version.\")\n",
"\n",
"install_button = widgets.Button(description=\"Install latest verticapy\")\n",
"install_button.on_click(install_verticapy)\n",
"\n",
"display(install_button, output_install)"
]
},
{
"cell_type": "markdown",
"id": "a935e70f-9cad-4149-9f66-a8c6b95e9405",
"metadata": {},
"source": [
"_________"
]
}
],
"metadata": {
Expand All @@ -356,7 +255,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.10.13"
}
},
"nbformat": 4,
Expand Down
39 changes: 39 additions & 0 deletions project/ui/qprof-ui.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "c7fde2aa-9a00-43b2-8e83-dc89087fa142",
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"from IPython.display import display, HTML\n",
"\n",
"# Define the URLs for the links\n",
"url1 = \"/lab/\"\n",
"url2 = \"/voila/render/ui/conn.ipynb\"\n",
"\n",
"# Define the button labels\n",
"button_label1 = \"Go to Home Page\"\n",
"button_label2 = \"Go to Connection\"\n",
"\n",
"# Define HTML links for buttons\n",
"button_html1 = f\"<a href='{url1}' style='text-decoration: none; padding: 8px; background-color: #007bff; color: white; border-radius: 5px; margin-right: 10px;'><i class='fa fa-home'></i></a>\"\n",
"button_html2 = f\"<a href='{url2}' style='text-decoration: none; padding: 8px; background-color: #007bff; color: white; border-radius: 5px;'>{button_label2}</a>\"\n",
"\n",
"\n",
"# Create HTML widgets\n",
"html_button1 = widgets.HTML(value=button_html1)\n",
"html_button2 = widgets.HTML(value=button_html2)\n",
"\n",
"# Display buttons\n",
"display(widgets.HBox([html_button1, html_button2]))\n"
]
},
{
"cell_type": "markdown",
"id": "662f76f4-35c2-4d00-8205-257eb50e3315",
"metadata": {},
"source": [
"________"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
Loading

0 comments on commit 6faa749

Please sign in to comment.