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 Main Page - Multiple SQL queries directly from text #282

Merged
merged 1 commit into from
Aug 12, 2024
Merged
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
18 changes: 17 additions & 1 deletion project/ui/qprof_main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -574,16 +574,32 @@
"output_0 = widgets.Output()\n",
"query_val = None\n",
"\n",
"# Split the queries\n",
"def query_list(sql_queries: str):\n",
" # Split the input string by \";\"\n",
" queries = [query.strip() for query in sql_queries.split(';') if query.strip()]\n",
" return queries\n",
"\n",
"# Check if there is at least one space inside the query - to avoid the \";;\" typo mistake.\n",
"def query_check(queries: list):\n",
" for query in queries:\n",
" if ' ' not in query:\n",
" return 1\n",
" return 0\n",
" \n",
"\n",
"def on_button_clicked_0(b):\n",
" output_0.clear_output(wait=True)\n",
" global query_val, target_schema_val_2, key_val_2\n",
" with output_0:\n",
" target_schema_val_2 = target_schema_2.value\n",
" query_val = query_list(query.value)\n",
" if not target_schema_val_2 == \"\" and not schema_exists(target_schema_val_2):\n",
" print(\"\\033[91m\\033[1m Error! The schema does not exist. \\033[0m\\033[0m\")\n",
" elif query_check(query_val):\n",
" print(\"\\033[91m\\033[1m Error! Re-check your query. \\033[0m\\033[0m\")\n",
" else:\n",
" key_val_2 = key_2.value\n",
" query_val = query.value\n",
" logging.info(f\"\"\"[Query Profile Main Page] For create using query option, saved key value as :{key_val_2}, target schema as {target_schema_val_2}, query as \"{query_val}\".\"\"\")\n",
" reset_values(query_val = query_val, target_schema_val_2 = target_schema_val_2, key_val_2 = key_val_2)\n",
"\n",
Expand Down
Loading