-
Notifications
You must be signed in to change notification settings - Fork 2
/
profiling_results_dialog.py
33 lines (24 loc) · 1.3 KB
/
profiling_results_dialog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import logging
import streamlit as st
import testgen.ui.queries.profiling_queries as profiling_queries
import testgen.ui.services.form_service as fm
from testgen.ui.views.profiling_details import show_profiling_detail
LOG = logging.getLogger("testgen")
BUTTON_TEXT = "Profiling →" # Profiling ⚲
BUTTON_HELP = "Review profiling for highlighted column"
def view_profiling_button(str_table_name, str_column_name, str_profile_run_id=None, str_table_groups_id=None):
if str_table_name != "(multi-table)":
if st.button(
BUTTON_TEXT, help=BUTTON_HELP, use_container_width=True
):
profiling_results_dialog(str_table_name, str_column_name, str_profile_run_id, str_table_groups_id)
@st.dialog(title="Profiling Results")
def profiling_results_dialog(str_table_name, str_column_name, str_profile_run_id=None, str_table_groups_id=None):
if not str_profile_run_id:
if str_table_groups_id:
str_profile_run_id = profiling_queries.get_latest_profile_run(str_table_groups_id)
if str_profile_run_id:
df = profiling_queries.get_profiling_detail(str_profile_run_id, str_table_name, str_column_name)
if not df.empty:
fm.show_prompt(f"Column: {str_column_name}, Table: {str_table_name}")
show_profiling_detail(df.iloc[0], 300)