Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryProfiler UI Changes (Explain Plan, Query Limit) + Connection page (time) #270

Merged
merged 5 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions project/ui/conn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"database = widgets.Text(description = \"Database\", placeholder = \"Enter Database (default is 'demo')\", layout=widgets.Layout(width='350px'))\n",
"name = widgets.Text(description = \"Name\", placeholder = \"Enter Name (default is 'VerticaDSN')\", layout=widgets.Layout(width='350px'))\n",
"\n",
"connection_timeout = widgets.Text(description = \"Connection timeout\", placeholder = \"Time in seconds (default is 5)\", layout=widgets.Layout(width='350px'))\n",
"connection_timeout = widgets.Text(description = \"Connection timeout\", placeholder = \"Time in seconds (default is 15)\", layout=widgets.Layout(width='350px'))\n",
"connection_timeout.style.description_width = '130px'\n",
"autocommit = widgets.Checkbox(value = False, description = 'Autocommit', disabled = False, indent = False,layout=widgets.Layout(width = '350px',align_items='flex-end'))\n",
"\n",
Expand Down Expand Up @@ -274,7 +274,7 @@
" 'password': password.value if password.value else \"\",\n",
" 'database': database.value if database.value else \"demo\",\n",
" 'ssl': ssl_context if dropdown.value ==\"TLS\" else False,\n",
" 'connection_timeout': eval(connection_timeout.value) if not connection_timeout.value == \"\" else 5,\n",
" 'connection_timeout': eval(connection_timeout.value) if not connection_timeout.value == \"\" else 15,\n",
" }\n",
" logging.info(f\"\"\"[Connection Page] Trying to connect with the following parameters: {conn_info},\"\"\")\n",
" vp.new_connection(\n",
Expand Down
22 changes: 16 additions & 6 deletions project/ui/qprof-ui.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
"logging.info('[Query Profile Tree Page] Importing Libraries')\n",
"import pickle\n",
"import ipywidgets as widgets\n",
"from datetime import datetime\n",
"from datetime import datetime, timezone\n",
"import time\n",
"import verticapy as vp\n",
"import plotly.graph_objects as go\n",
"from verticapy.performance.vertica import QueryProfilerInterface, QueryProfiler\n",
Expand Down Expand Up @@ -473,9 +474,9 @@
" with output_run_query:\n",
" query_val = query.value\n",
" logging.info(f\"\"\"[Query Profile Tree Page] Running the following query manually :{query_val}.\"\"\")\n",
" now = datetime.now()\n",
" current_time = now.strftime(\"%Y-%m-%d %H:%M:%S\")\n",
" display(HTML(f\"<b>Last executed:</b> {current_time}\"))\n",
" now = datetime.now(timezone.utc).astimezone()\n",
" current_time = now.strftime(\"%Y-%m-%d %H:%M:%S %Z %z\")\n",
" display(HTML(f\"<b>Last executed (VerticaPyLab container time with UTC offset):</b> {current_time}\"))\n",
" vp.vDataFrame(query_val).idisplay()\n",
"\n",
"button_run_query.on_click(on_button_clicked_run_query)\n",
Expand Down Expand Up @@ -614,9 +615,18 @@
"source": [
"button_run_explain_plan = widgets.Button(description=\"Run Explain Plan\")\n",
"explain_output = widgets.Output()\n",
"explain_dropdown = widgets.Dropdown(\n",
" options=[i for i in range(len(qprof.transactions))],\n",
" description='Select Query Index',\n",
" disabled=False,\n",
" layout={'width': \"300px\"}\n",
")\n",
"explain_dropdown.style.description_width = '130px'\n",
"\n",
"def on_button_clicked_run_explain_plan(b):\n",
" explain_output.clear_output()\n",
" with explain_output:\n",
" qprof.set_position(explain_dropdown.value)\n",
" qprof.get_qplan_explain()\n",
"\n",
"\n",
Expand All @@ -630,7 +640,7 @@
" display(widgets.HTML(run_query_result._repr_html_()))\n",
"\n",
"button_run_explain_plan.on_click(on_button_clicked_run_explain_plan)\n",
"explain_plan_widget = widgets.VBox([button_run_explain_plan, explain_output]) "
"explain_plan_widget = widgets.VBox([explain_dropdown, button_run_explain_plan, explain_output]) "
]
},
{
Expand Down Expand Up @@ -674,7 +684,7 @@
"</head>\n",
"<body>\n",
" <div class=\"version\">\n",
" Page version update date: 6/4/2024\n",
" Page version update date: 6/10/2024\n",
" </div>\n",
"</body>\n",
"</html>"
Expand Down
4 changes: 2 additions & 2 deletions project/ui/qprof_main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@
" else:\n",
" query_search_wild_card = ''\n",
" logging.info(f'[Query Profile Main Page] Trying to fetch the queries from query_request table using the label: {request_label_input.value}, and query text: {query_search_input.value}')\n",
" sql_query = f\"SELECT * from query_requests WHERE request_type = 'QUERY' AND request_label LIKE '{request_label_wild_card}{request_label_input.value}{request_label_wild_card}' AND request LIKE '{query_search_wild_card}{query_search_input.value}{query_search_wild_card}' ORDER BY request_duration_ms DESC LIMIT 6;\"\n",
" sql_query = f\"SELECT * from query_requests WHERE request_type = 'QUERY' AND request_label LIKE '{request_label_wild_card}{request_label_input.value}{request_label_wild_card}' AND request LIKE '{query_search_wild_card}{query_search_input.value}{query_search_wild_card}' ORDER BY request_duration_ms DESC LIMIT 50;\"\n",
" result = vp.vDataFrame(sql_query)\n",
" logging.info('[Query Profile Main Page] Successfully fetched the queries from query_request table')\n",
" result.idisplay()\n",
Expand Down Expand Up @@ -660,7 +660,7 @@
"</head>\n",
"<body>\n",
" <div class=\"version\">\n",
" Page version update date: 6/5/2024\n",
" Page version update date: 6/10/2024\n",
" </div>\n",
"</body>\n",
"</html>"
Expand Down
Loading