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

Make All vDataframe -> Idisplay #263

Merged
merged 3 commits into from
May 28, 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
23 changes: 16 additions & 7 deletions project/ui/qprof-ui.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"logging.info('[Query Profile Tree Page] Importing Libraries')\n",
"import pickle\n",
"import ipywidgets as widgets\n",
"from datetime import datetime\n",
"import verticapy as vp\n",
"from verticapy.performance.vertica import QueryProfilerInterface, QueryProfiler\n",
"logging.info('[Query Profile Tree Page] Successfully Imported Libraries ')\n",
Expand Down Expand Up @@ -399,8 +400,12 @@
" logging.info(f'[Query Profile Tree Page] Trying to get the DC SLOW EVENTS table')\n",
" res_1 = vp.vDataFrame(f\"\"\"{query}\"\"\")\n",
" res_2 = vp.vDataFrame(f\"\"\"{query_2}\"\"\")\n",
" table_1 = widgets.VBox([widgets.HTML(res_1._repr_html_())])\n",
" table_2 = widgets.VBox([widgets.HTML(res_2._repr_html_())])\n",
" table_1 = widgets.Output()\n",
" table_2 = widgets.Output()\n",
" with table_1:\n",
" res_1.idisplay()\n",
" with table_2:\n",
" res_2.idisplay()\n",
" tables = widgets.Tab()\n",
" tables.children = [table_1, table_2]\n",
" tables.titles = [\"Slow Events\", \"Optimimzer Events\"]\n",
Expand All @@ -409,8 +414,10 @@
" tables = widgets.VBox([widgets.HTML(f\"<p style='color:red'>The following error occured: </p> <p> {e}</p>\")])\n",
"\n",
"try:\n",
" transactions_table = qprof.get_queries()\n",
" transactions_table = widgets.VBox([widgets.HTML(transactions_table._repr_html_())])\n",
" transactions_table_output = widgets.Output()\n",
" with transactions_table_output:\n",
" qprof.get_queries()[qprof.get_queries().get_columns(exclude_columns = \"is_current\")].idisplay()\n",
" transactions_table = widgets.VBox([transactions_table_output])\n",
"except Exception as e:\n",
" transactions_table = widgets.VBox([widgets.HTML(f\"<p style='color:red'>The following error occured: </p> <p> {e}</p>\")])"
]
Expand All @@ -436,7 +443,7 @@
"child_3 = widgets.VBox([tables])\n",
"\n",
"tabs.children = [child_1, child_2, child_3]\n",
"tabs.titles = [\"Tree\", \"Transaction\", \"Other info\"]\n",
"tabs.titles = [\"Tree\", \"Transaction List\", \"Other info\"]\n",
"display(tabs)"
]
},
Expand All @@ -463,8 +470,10 @@
" 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",
" run_query_result = vp.vDataFrame(query_val)\n",
" display(widgets.HTML(run_query_result._repr_html_()))\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",
" vp.vDataFrame(query_val).idisplay()\n",
"\n",
"button_run_query.on_click(on_button_clicked_run_query)\n",
"manual_query = widgets.VBox([query, button_run_query, output_run_query])\n"
Expand Down
2 changes: 1 addition & 1 deletion project/ui/qprof_main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@
" sql_query = \"SELECT * from query_requests WHERE request_type = 'QUERY' AND request LIKE 'select%' ORDER BY request_duration_ms DESC LIMIT 6;\"\n",
" result = vp.vDataFrame(sql_query)\n",
" logging.info('[Query Profile Main Page] Successfully fetched the queries from query_request table')\n",
" display(HTML(result._repr_html_()))\n",
" result.idisplay()\n",
" \n",
"logging.info('Trying to display Query Request Table button [Query Profile Main Page]')\n",
"button_01.on_click(on_button_clicked_01)\n",
Expand Down
Loading