dataops-testgen 2.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dataops_testgen-2.2.0.dist-info/LICENSE +203 -0
- dataops_testgen-2.2.0.dist-info/METADATA +287 -0
- dataops_testgen-2.2.0.dist-info/NOTICE +5 -0
- dataops_testgen-2.2.0.dist-info/RECORD +270 -0
- dataops_testgen-2.2.0.dist-info/WHEEL +5 -0
- dataops_testgen-2.2.0.dist-info/entry_points.txt +2 -0
- dataops_testgen-2.2.0.dist-info/top_level.txt +1 -0
- testgen/__init__.py +0 -0
- testgen/__main__.py +770 -0
- testgen/commands/__init__.py +0 -0
- testgen/commands/queries/__init__.py +0 -0
- testgen/commands/queries/execute_cat_tests_query.py +95 -0
- testgen/commands/queries/execute_tests_query.py +160 -0
- testgen/commands/queries/generate_tests_query.py +94 -0
- testgen/commands/queries/profiling_query.py +366 -0
- testgen/commands/queries/test_parameter_validation_query.py +88 -0
- testgen/commands/run_execute_cat_tests.py +162 -0
- testgen/commands/run_execute_tests.py +168 -0
- testgen/commands/run_generate_tests.py +107 -0
- testgen/commands/run_get_entities.py +122 -0
- testgen/commands/run_launch_db_config.py +84 -0
- testgen/commands/run_observability_exporter.py +330 -0
- testgen/commands/run_profiling_bridge.py +495 -0
- testgen/commands/run_quick_start.py +168 -0
- testgen/commands/run_setup_profiling_tools.py +96 -0
- testgen/commands/run_test_definition.py +146 -0
- testgen/commands/run_test_parameter_validation.py +135 -0
- testgen/commands/run_upgrade_db_config.py +156 -0
- testgen/common/__init__.py +8 -0
- testgen/common/clean_sql.py +53 -0
- testgen/common/credentials.py +25 -0
- testgen/common/database/__init__.py +0 -0
- testgen/common/database/database_service.py +629 -0
- testgen/common/database/flavor/__init__.py +0 -0
- testgen/common/database/flavor/flavor_service.py +75 -0
- testgen/common/database/flavor/mssql_flavor_service.py +34 -0
- testgen/common/database/flavor/postgresql_flavor_service.py +5 -0
- testgen/common/database/flavor/redshift_flavor_service.py +22 -0
- testgen/common/database/flavor/snowflake_flavor_service.py +69 -0
- testgen/common/database/flavor/trino_flavor_service.py +21 -0
- testgen/common/date_service.py +68 -0
- testgen/common/display_service.py +85 -0
- testgen/common/docker_service.py +76 -0
- testgen/common/encrypt.py +55 -0
- testgen/common/get_pipeline_parms.py +57 -0
- testgen/common/logs.py +79 -0
- testgen/common/process_service.py +62 -0
- testgen/common/read_file.py +69 -0
- testgen/settings.py +440 -0
- testgen/template/dbsetup/010_create_base_schema.sql +2 -0
- testgen/template/dbsetup/020_create_standard_functions_sprocs.sql +179 -0
- testgen/template/dbsetup/030_initialize_new_schema_structure.sql +735 -0
- testgen/template/dbsetup/040_populate_new_schema_project.sql +59 -0
- testgen/template/dbsetup/050_populate_new_schema_metadata.sql +1517 -0
- testgen/template/dbsetup/060_create_standard_views.sql +248 -0
- testgen/template/dbsetup/070_create_default_users.sql +17 -0
- testgen/template/dbsetup/075_grant_role_rights.sql +43 -0
- testgen/template/dbsetup/080_set_current_revision.sql +5 -0
- testgen/template/dbupgrade/0100_incremental_upgrade.sql +5 -0
- testgen/template/dbupgrade/0101_incremental_upgrade.sql +15 -0
- testgen/template/dbupgrade/0102_incremental_upgrade.sql +4 -0
- testgen/template/dbupgrade/0103_incremental_upgrade.sql +22 -0
- testgen/template/dbupgrade/0104_incremental_upgrade.sql +44 -0
- testgen/template/dbupgrade/0105_incremental_upgrade.sql +1 -0
- testgen/template/dbupgrade/0106_incremental_upgrade.sql +5 -0
- testgen/template/dbupgrade/0107_incremental_upgrade.sql +3 -0
- testgen/template/dbupgrade_helpers/get_tg_revision.sql +2 -0
- testgen/template/exec_cat_tests/ex_cat_build_agg_table_tests.sql +116 -0
- testgen/template/exec_cat_tests/ex_cat_get_distinct_tables.sql +11 -0
- testgen/template/exec_cat_tests/ex_cat_results_parse.sql +69 -0
- testgen/template/exec_cat_tests/ex_cat_retrieve_agg_test_parms.sql +6 -0
- testgen/template/exec_cat_tests/ex_cat_test_query.sql +8 -0
- testgen/template/execution/ex_finalize_test_run_results.sql +37 -0
- testgen/template/execution/ex_get_tests_non_cat.sql +47 -0
- testgen/template/execution/ex_update_test_record_in_testrun_table.sql +27 -0
- testgen/template/execution/ex_write_test_record_to_testrun_table.sql +6 -0
- testgen/template/flavors/generic/exec_query_tests/ex_aggregate_match_no_drops_generic.sql +48 -0
- testgen/template/flavors/generic/exec_query_tests/ex_aggregate_match_num_incr_generic.sql +34 -0
- testgen/template/flavors/generic/exec_query_tests/ex_aggregate_match_percent_above_generic.sql +49 -0
- testgen/template/flavors/generic/exec_query_tests/ex_aggregate_match_percent_within_generic.sql +49 -0
- testgen/template/flavors/generic/exec_query_tests/ex_aggregate_match_same_generic.sql +49 -0
- testgen/template/flavors/generic/exec_query_tests/ex_custom_query_generic.sql +39 -0
- testgen/template/flavors/generic/exec_query_tests/ex_data_match_2way_generic.sql +58 -0
- testgen/template/flavors/generic/exec_query_tests/ex_data_match_generic.sql +44 -0
- testgen/template/flavors/generic/exec_query_tests/ex_prior_match_generic.sql +37 -0
- testgen/template/flavors/generic/exec_query_tests/ex_relative_entropy_generic.sql +53 -0
- testgen/template/flavors/generic/exec_query_tests/ex_window_match_no_drops_generic.sql +46 -0
- testgen/template/flavors/generic/exec_query_tests/ex_window_match_same_generic.sql +59 -0
- testgen/template/flavors/generic/profiling/contingency_counts.sql +3 -0
- testgen/template/flavors/generic/validate_tests/ex_get_project_column_list_generic.sql +3 -0
- testgen/template/flavors/mssql/exec_query_tests/ex_relative_entropy_mssql.sql +53 -0
- testgen/template/flavors/mssql/profiling/project_ddf_query_mssql.sql +35 -0
- testgen/template/flavors/mssql/profiling/project_profiling_query_mssql.yaml +246 -0
- testgen/template/flavors/mssql/profiling/project_secondary_profiling_query_mssql.sql +36 -0
- testgen/template/flavors/mssql/setup_profiling_tools/00_drop_existing_functions_mssql.sql +8 -0
- testgen/template/flavors/mssql/setup_profiling_tools/01_create_functions_mssql.sql +12 -0
- testgen/template/flavors/mssql/setup_profiling_tools/02_create_functions_mssql.sql +54 -0
- testgen/template/flavors/mssql/setup_profiling_tools/create_qc_schema_mssql.sql +4 -0
- testgen/template/flavors/mssql/setup_profiling_tools/grant_execute_privileges_mssql.sql +1 -0
- testgen/template/flavors/postgresql/exec_query_tests/ex_window_match_no_drops_postgresql.sql +46 -0
- testgen/template/flavors/postgresql/exec_query_tests/ex_window_match_same_postgresql.sql +59 -0
- testgen/template/flavors/postgresql/profiling/project_ddf_query_postgresql.sql +42 -0
- testgen/template/flavors/postgresql/profiling/project_profiling_query_postgresql.yaml +225 -0
- testgen/template/flavors/postgresql/profiling/project_secondary_profiling_query_postgresql.sql +28 -0
- testgen/template/flavors/postgresql/setup_profiling_tools/create_functions_postgresql.sql +157 -0
- testgen/template/flavors/postgresql/setup_profiling_tools/create_qc_schema_postgresql.sql +1 -0
- testgen/template/flavors/postgresql/setup_profiling_tools/grant_execute_privileges_postgresql.sql +2 -0
- testgen/template/flavors/redshift/profiling/project_ddf_query_redshift.sql +38 -0
- testgen/template/flavors/redshift/profiling/project_profiling_query_redshift.yaml +221 -0
- testgen/template/flavors/redshift/profiling/project_secondary_profiling_query_redshift.sql +29 -0
- testgen/template/flavors/redshift/setup_profiling_tools/create_functions_redshift.sql +115 -0
- testgen/template/flavors/redshift/setup_profiling_tools/create_qc_schema_redshift.sql +1 -0
- testgen/template/flavors/redshift/setup_profiling_tools/grant_execute_privileges_redshift.sql +2 -0
- testgen/template/flavors/snowflake/profiling/project_ddf_query_snowflake.sql +38 -0
- testgen/template/flavors/snowflake/profiling/project_profiling_query_snowflake.yaml +220 -0
- testgen/template/flavors/snowflake/profiling/project_secondary_profiling_query_snowflake.sql +29 -0
- testgen/template/flavors/snowflake/setup_profiling_tools/create_functions_snowflake.sql +69 -0
- testgen/template/flavors/snowflake/setup_profiling_tools/create_qc_schema_snowflake.sql +1 -0
- testgen/template/flavors/snowflake/setup_profiling_tools/grant_execute_privileges_snowflake.sql +6 -0
- testgen/template/flavors/trino/profiling/project_profiling_query_trino.yaml +219 -0
- testgen/template/flavors/trino/setup_profiling_tools/create_functions_trino.sql +92 -0
- testgen/template/flavors/trino/setup_profiling_tools/create_qc_schema_trino.sql +1 -0
- testgen/template/gen_funny_cat_tests/gen_test_constant.sql +104 -0
- testgen/template/gen_funny_cat_tests/gen_test_distinct_value_ct.sql +98 -0
- testgen/template/gen_funny_cat_tests/gen_test_row_ct.sql +57 -0
- testgen/template/gen_funny_cat_tests/gen_test_row_ct_pct.sql +59 -0
- testgen/template/generation/gen_delete_old_tests.sql +5 -0
- testgen/template/generation/gen_insert_test_suite.sql +5 -0
- testgen/template/generation/gen_retrieve_or_insert_test_suite.sql +58 -0
- testgen/template/generation/gen_standard_test_type_list.sql +13 -0
- testgen/template/generation/gen_standard_tests.sql +48 -0
- testgen/template/get_entities/get_connection.sql +21 -0
- testgen/template/get_entities/get_connections_list.sql +9 -0
- testgen/template/get_entities/get_latest.sql +4 -0
- testgen/template/get_entities/get_profile.sql +12 -0
- testgen/template/get_entities/get_profile_info.sql +17 -0
- testgen/template/get_entities/get_profile_list.sql +17 -0
- testgen/template/get_entities/get_profile_screen.sql +275 -0
- testgen/template/get_entities/get_project_list.sql +6 -0
- testgen/template/get_entities/get_table_group_list.sql +10 -0
- testgen/template/get_entities/get_test_generation_list.sql +18 -0
- testgen/template/get_entities/get_test_info.sql +41 -0
- testgen/template/get_entities/get_test_results_for_run_cli.sql +16 -0
- testgen/template/get_entities/get_test_run_list.sql +24 -0
- testgen/template/get_entities/get_test_suite.sql +13 -0
- testgen/template/get_entities/get_test_suite_list.sql +18 -0
- testgen/template/get_entities/list_test_types.sql +4 -0
- testgen/template/observability/get_event_data.sql +23 -0
- testgen/template/observability/get_test_results.sql +41 -0
- testgen/template/observability/update_test_results_exported_to_observability.sql +12 -0
- testgen/template/parms/parms_profiling.sql +34 -0
- testgen/template/parms/parms_test_execution.sql +13 -0
- testgen/template/parms/parms_test_gen.sql +23 -0
- testgen/template/profiling/contingency_columns.sql +7 -0
- testgen/template/profiling/datatype_suggestions.sql +56 -0
- testgen/template/profiling/functional_datatype.sql +523 -0
- testgen/template/profiling/functional_tabletype_stage.sql +48 -0
- testgen/template/profiling/functional_tabletype_update.sql +8 -0
- testgen/template/profiling/pii_flag.sql +133 -0
- testgen/template/profiling/profile_anomalies_screen_column.sql +22 -0
- testgen/template/profiling/profile_anomalies_screen_multi_column.sql +58 -0
- testgen/template/profiling/profile_anomalies_screen_table.sql +22 -0
- testgen/template/profiling/profile_anomalies_screen_table_dates.sql +30 -0
- testgen/template/profiling/profile_anomalies_screen_variants.sql +40 -0
- testgen/template/profiling/profile_anomaly_types_get.sql +3 -0
- testgen/template/profiling/project_get_table_sample_count.sql +22 -0
- testgen/template/profiling/project_profile_run_record_insert.sql +8 -0
- testgen/template/profiling/project_profile_run_record_update.sql +5 -0
- testgen/template/profiling/project_profile_run_record_update_status.sql +5 -0
- testgen/template/profiling/project_update_profile_results_to_estimates.sql +32 -0
- testgen/template/profiling/refresh_anomalies.sql +33 -0
- testgen/template/profiling/refresh_data_chars_from_profiling.sql +156 -0
- testgen/template/profiling/secondary_profiling_columns.sql +12 -0
- testgen/template/profiling/secondary_profiling_delete.sql +4 -0
- testgen/template/profiling/secondary_profiling_update.sql +18 -0
- testgen/template/quick_start/populate_target_data.sql +1077 -0
- testgen/template/quick_start/recreate_target_data_schema.sql +167 -0
- testgen/template/quick_start/update_target_data.sql +100 -0
- testgen/template/updates/create_tmp_test_definition.sql +19 -0
- testgen/template/updates/get_test_def_parms.sql +38 -0
- testgen/template/updates/populate_stg_test_definitions.sql +184 -0
- testgen/template/validate_tests/ex_disable_tests_test_definitions.sql +5 -0
- testgen/template/validate_tests/ex_flag_tests_test_definitions.sql +64 -0
- testgen/template/validate_tests/ex_get_project_column_list_generic.sql +3 -0
- testgen/template/validate_tests/ex_get_test_column_list_tg.sql +65 -0
- testgen/template/validate_tests/ex_write_test_val_errors.sql +22 -0
- testgen/ui/__init__.py +0 -0
- testgen/ui/app.py +98 -0
- testgen/ui/assets/dk_logo.svg +46 -0
- testgen/ui/assets/question_mark.png +0 -0
- testgen/ui/assets/scripts.js +68 -0
- testgen/ui/assets/style.css +140 -0
- testgen/ui/bootstrap.py +109 -0
- testgen/ui/components/__init__.py +0 -0
- testgen/ui/components/frontend/css/KFOlCnqEu92Fr1MmEU9fBBc4.woff2 +0 -0
- testgen/ui/components/frontend/css/KFOlCnqEu92Fr1MmEU9fChc4EsA.woff2 +0 -0
- testgen/ui/components/frontend/css/KFOmCnqEu92Fr1Mu4mxK.woff2 +0 -0
- testgen/ui/components/frontend/css/KFOmCnqEu92Fr1Mu7GxKOzY.woff2 +0 -0
- testgen/ui/components/frontend/css/material-symbols-rounded.css +24 -0
- testgen/ui/components/frontend/css/material-symbols-rounded.woff2 +0 -0
- testgen/ui/components/frontend/css/roboto-font-faces.css +35 -0
- testgen/ui/components/frontend/css/shared.css +36 -0
- testgen/ui/components/frontend/img/dk_logo.svg +46 -0
- testgen/ui/components/frontend/index.html +17 -0
- testgen/ui/components/frontend/js/components/breadcrumbs.js +86 -0
- testgen/ui/components/frontend/js/components/button.js +66 -0
- testgen/ui/components/frontend/js/components/location.js +62 -0
- testgen/ui/components/frontend/js/components/select.js +75 -0
- testgen/ui/components/frontend/js/components/sidebar.js +358 -0
- testgen/ui/components/frontend/js/main.js +99 -0
- testgen/ui/components/frontend/js/streamlit.js +19 -0
- testgen/ui/components/frontend/js/van.min.js +1 -0
- testgen/ui/components/utils/__init__.py +0 -0
- testgen/ui/components/utils/callbacks.py +51 -0
- testgen/ui/components/utils/component.py +13 -0
- testgen/ui/components/widgets/__init__.py +6 -0
- testgen/ui/components/widgets/breadcrumbs.py +32 -0
- testgen/ui/components/widgets/location.py +65 -0
- testgen/ui/components/widgets/modal.py +97 -0
- testgen/ui/components/widgets/sidebar.py +69 -0
- testgen/ui/navigation/__init__.py +0 -0
- testgen/ui/navigation/menu.py +42 -0
- testgen/ui/navigation/page.py +20 -0
- testgen/ui/navigation/router.py +63 -0
- testgen/ui/queries/__init__.py +0 -0
- testgen/ui/queries/authentication_queries.py +47 -0
- testgen/ui/queries/connection_queries.py +121 -0
- testgen/ui/queries/profiling_queries.py +148 -0
- testgen/ui/queries/project_queries.py +9 -0
- testgen/ui/queries/table_group_queries.py +186 -0
- testgen/ui/queries/test_definition_queries.py +270 -0
- testgen/ui/queries/test_run_queries.py +32 -0
- testgen/ui/queries/test_suite_queries.py +145 -0
- testgen/ui/scripts/__init__.py +0 -0
- testgen/ui/scripts/patch_streamlit.py +111 -0
- testgen/ui/services/__init__.py +0 -0
- testgen/ui/services/authentication_service.py +119 -0
- testgen/ui/services/connection_service.py +220 -0
- testgen/ui/services/database_service.py +282 -0
- testgen/ui/services/form_service.py +1008 -0
- testgen/ui/services/javascript_service.py +44 -0
- testgen/ui/services/query_service.py +316 -0
- testgen/ui/services/string_service.py +12 -0
- testgen/ui/services/table_group_service.py +130 -0
- testgen/ui/services/test_definition_service.py +117 -0
- testgen/ui/services/test_run_service.py +13 -0
- testgen/ui/services/test_suite_service.py +76 -0
- testgen/ui/services/toolbar_service.py +77 -0
- testgen/ui/session.py +46 -0
- testgen/ui/views/__init__.py +0 -0
- testgen/ui/views/app_log_modal.py +92 -0
- testgen/ui/views/connections.py +72 -0
- testgen/ui/views/connections_base.py +367 -0
- testgen/ui/views/login.py +40 -0
- testgen/ui/views/not_found.py +16 -0
- testgen/ui/views/overview.py +34 -0
- testgen/ui/views/profiling_anomalies.py +501 -0
- testgen/ui/views/profiling_details.py +335 -0
- testgen/ui/views/profiling_modal.py +40 -0
- testgen/ui/views/profiling_results.py +206 -0
- testgen/ui/views/profiling_summary.py +177 -0
- testgen/ui/views/project_settings.py +74 -0
- testgen/ui/views/table_groups.py +530 -0
- testgen/ui/views/test_definitions.py +1020 -0
- testgen/ui/views/test_results.py +908 -0
- testgen/ui/views/test_runs.py +195 -0
- testgen/ui/views/test_suites.py +545 -0
- testgen/utils/__init__.py +0 -0
- testgen/utils/plugins.py +17 -0
- testgen/utils/singleton.py +14 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
3
|
+
import streamlit as st
|
|
4
|
+
|
|
5
|
+
import testgen.common.process_service as process_service
|
|
6
|
+
import testgen.ui.services.database_service as db
|
|
7
|
+
import testgen.ui.services.form_service as fm
|
|
8
|
+
import testgen.ui.services.query_service as dq
|
|
9
|
+
import testgen.ui.services.toolbar_service as tb
|
|
10
|
+
from testgen.commands.run_profiling_bridge import update_profile_run_status
|
|
11
|
+
from testgen.common import date_service
|
|
12
|
+
from testgen.ui.navigation.menu import MenuItem
|
|
13
|
+
from testgen.ui.navigation.page import Page
|
|
14
|
+
from testgen.ui.session import session
|
|
15
|
+
|
|
16
|
+
FORM_DATA_WIDTH = 400
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class DataProfilingPage(Page):
|
|
20
|
+
path = "profiling"
|
|
21
|
+
can_activate: typing.ClassVar = [
|
|
22
|
+
lambda: session.authentication_status or "login",
|
|
23
|
+
]
|
|
24
|
+
menu_item = MenuItem(icon="problem", label="Data Profiling", order=1)
|
|
25
|
+
|
|
26
|
+
def render(self) -> None:
|
|
27
|
+
fm.render_page_header(
|
|
28
|
+
"Profiling Runs",
|
|
29
|
+
"https://docs.datakitchen.io/article/dataops-testgen-help/investigate-profiling",
|
|
30
|
+
lst_breadcrumbs=[
|
|
31
|
+
{"label": "Overview", "path": "overview"},
|
|
32
|
+
{"label": "Data Profiling", "path": None},
|
|
33
|
+
],
|
|
34
|
+
boo_show_refresh=True,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
if "project" not in st.session_state:
|
|
38
|
+
st.write("Select a Project from the Overview page.")
|
|
39
|
+
else:
|
|
40
|
+
str_project = st.session_state["project"]
|
|
41
|
+
|
|
42
|
+
# Setup Toolbar
|
|
43
|
+
tool_bar = tb.ToolBar(3, 2, 0, None)
|
|
44
|
+
|
|
45
|
+
with tool_bar.long_slots[0]:
|
|
46
|
+
# Table Groups selection -- optional criterion
|
|
47
|
+
df_tg = get_db_table_group_choices(str_project)
|
|
48
|
+
str_table_groups_id = fm.render_select(
|
|
49
|
+
"Table Group", df_tg, "table_groups_name", "id", boo_required=False, str_default=None
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
df, show_columns = get_db_profiling_runs(str_project, str_table_groups_id)
|
|
53
|
+
|
|
54
|
+
time_columns = ["start_time"]
|
|
55
|
+
date_service.accommodate_dataframe_to_timezone(df, st.session_state, time_columns)
|
|
56
|
+
|
|
57
|
+
dct_selected_rows = fm.render_grid_select(df, show_columns)
|
|
58
|
+
|
|
59
|
+
open_drill_downs(dct_selected_rows, tool_bar.short_slots)
|
|
60
|
+
|
|
61
|
+
if dct_selected_rows:
|
|
62
|
+
show_record_detail(dct_selected_rows[0])
|
|
63
|
+
st.markdown(":orange[Click a button to view profiling outcomes for the selected run.]")
|
|
64
|
+
else:
|
|
65
|
+
st.markdown(":orange[Select a run to see more information.]")
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@st.cache_data(show_spinner=False)
|
|
69
|
+
def get_db_table_group_choices(str_project_code):
|
|
70
|
+
str_schema = st.session_state["dbschema"]
|
|
71
|
+
return dq.run_table_groups_lookup_query(str_schema, str_project_code)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@st.cache_data(show_spinner="Retrieving Data")
|
|
75
|
+
def get_db_profiling_runs(str_project_code, str_tg=None):
|
|
76
|
+
str_schema = st.session_state["dbschema"]
|
|
77
|
+
str_tg_condition = f" AND table_groups_id = '{str_tg}' " if str_tg else ""
|
|
78
|
+
str_sql = f"""
|
|
79
|
+
SELECT project_code, connection_name,
|
|
80
|
+
connection_id::VARCHAR,
|
|
81
|
+
table_groups_id::VARCHAR,
|
|
82
|
+
profiling_run_id::VARCHAR,
|
|
83
|
+
table_groups_name, schema_name, start_time, duration,
|
|
84
|
+
CASE
|
|
85
|
+
WHEN status = 'Running' AND start_time < CURRENT_DATE - 1 THEN 'Error'
|
|
86
|
+
ELSE status
|
|
87
|
+
END as status,
|
|
88
|
+
COALESCE(log_message, '(No Errors)') as log_message,
|
|
89
|
+
table_ct, column_ct,
|
|
90
|
+
anomaly_ct, anomaly_table_ct, anomaly_column_ct, process_id
|
|
91
|
+
FROM {str_schema}.v_profiling_runs
|
|
92
|
+
WHERE project_code = '{str_project_code}' {str_tg_condition}
|
|
93
|
+
ORDER BY start_time DESC;
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
show_columns = [
|
|
97
|
+
"connection_name",
|
|
98
|
+
"table_groups_name",
|
|
99
|
+
"schema_name",
|
|
100
|
+
"start_time",
|
|
101
|
+
"duration",
|
|
102
|
+
"status",
|
|
103
|
+
"table_ct",
|
|
104
|
+
"column_ct",
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
return db.retrieve_data(str_sql), show_columns
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def open_drill_downs(dct_selected_rows, button_slots):
|
|
111
|
+
dct_selected_row = None
|
|
112
|
+
if dct_selected_rows:
|
|
113
|
+
dct_selected_row = dct_selected_rows[0]
|
|
114
|
+
|
|
115
|
+
if button_slots[0].button(
|
|
116
|
+
f":{'gray' if not dct_selected_rows else 'green'}[Profiling →]",
|
|
117
|
+
help="Review profiling characteristics for each data column",
|
|
118
|
+
use_container_width=True,
|
|
119
|
+
disabled=not dct_selected_rows,
|
|
120
|
+
):
|
|
121
|
+
st.session_state["drill_profile_run"] = dct_selected_row["profiling_run_id"]
|
|
122
|
+
session.current_page = "profiling/results"
|
|
123
|
+
session.current_page_args = {}
|
|
124
|
+
st.experimental_rerun()
|
|
125
|
+
|
|
126
|
+
if button_slots[1].button(
|
|
127
|
+
f":{'gray' if not dct_selected_rows else 'green'}[Hygiene →]",
|
|
128
|
+
help="Review potential data problems identified in profiling",
|
|
129
|
+
use_container_width=True,
|
|
130
|
+
disabled=not dct_selected_rows,
|
|
131
|
+
):
|
|
132
|
+
st.session_state["drill_profile_run"] = dct_selected_row["profiling_run_id"]
|
|
133
|
+
st.session_state["drill_profile_tg"] = dct_selected_row["table_groups_id"]
|
|
134
|
+
session.current_page = "profiling/hygiene"
|
|
135
|
+
session.current_page_args = {}
|
|
136
|
+
st.experimental_rerun()
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def show_record_detail(dct_selected_row):
|
|
140
|
+
bottom_left_column, bottom_right_column = st.columns([0.5, 0.5])
|
|
141
|
+
|
|
142
|
+
with bottom_left_column:
|
|
143
|
+
str_header = "Profiling Run Information"
|
|
144
|
+
lst_columns = [
|
|
145
|
+
"connection_name",
|
|
146
|
+
"table_groups_name",
|
|
147
|
+
"schema_name",
|
|
148
|
+
"log_message",
|
|
149
|
+
"table_ct",
|
|
150
|
+
"column_ct",
|
|
151
|
+
"anomaly_ct",
|
|
152
|
+
"anomaly_table_ct",
|
|
153
|
+
"anomaly_column_ct",
|
|
154
|
+
]
|
|
155
|
+
fm.render_html_list(dct_selected_row, lst_columns, str_header, FORM_DATA_WIDTH)
|
|
156
|
+
|
|
157
|
+
with bottom_right_column:
|
|
158
|
+
st.write("<br/><br/>", unsafe_allow_html=True)
|
|
159
|
+
_, button_column = st.columns([0.3, 0.7])
|
|
160
|
+
with button_column:
|
|
161
|
+
enable_kill_button = dct_selected_row and dct_selected_row["process_id"] is not None and dct_selected_row["status"] == "Running"
|
|
162
|
+
|
|
163
|
+
if enable_kill_button:
|
|
164
|
+
if st.button(
|
|
165
|
+
":red[Cancel Run]",
|
|
166
|
+
help="Kill the selected profile run",
|
|
167
|
+
use_container_width=True,
|
|
168
|
+
disabled=not enable_kill_button,
|
|
169
|
+
):
|
|
170
|
+
process_id = dct_selected_row["process_id"]
|
|
171
|
+
profile_run_id = dct_selected_row["profiling_run_id"]
|
|
172
|
+
status, message = process_service.kill_profile_run(process_id)
|
|
173
|
+
|
|
174
|
+
if status:
|
|
175
|
+
update_profile_run_status(profile_run_id, "Cancelled")
|
|
176
|
+
|
|
177
|
+
fm.reset_post_updates(str_message=f":{'green' if status else 'red'}[{message}]", as_toast=True)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
3
|
+
import streamlit as st
|
|
4
|
+
|
|
5
|
+
from testgen.commands.run_observability_exporter import test_observability_exporter
|
|
6
|
+
from testgen.ui.navigation.menu import MenuItem
|
|
7
|
+
from testgen.ui.navigation.page import Page
|
|
8
|
+
from testgen.ui.services import form_service, query_service
|
|
9
|
+
from testgen.ui.session import session
|
|
10
|
+
from testgen.ui.views.app_log_modal import view_log_file
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ProjectSettingsPage(Page):
|
|
14
|
+
path = "settings/project"
|
|
15
|
+
can_activate: typing.ClassVar = [
|
|
16
|
+
lambda: session.authentication_status or "login",
|
|
17
|
+
lambda: session.project is not None or "overview",
|
|
18
|
+
]
|
|
19
|
+
menu_item = MenuItem(icon="settings", label="Settings", order=100)
|
|
20
|
+
|
|
21
|
+
def render(self) -> None:
|
|
22
|
+
form_service.render_page_header(
|
|
23
|
+
"Settings",
|
|
24
|
+
"https://docs.datakitchen.io/article/dataops-testgen-help/configuration",
|
|
25
|
+
lst_breadcrumbs=[
|
|
26
|
+
{"label": "Overview", "path": "overview"},
|
|
27
|
+
{"label": "Settings", "path": None},
|
|
28
|
+
],
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
project = get_current_project(session.project)
|
|
32
|
+
|
|
33
|
+
form_service.render_edit_form(
|
|
34
|
+
"",
|
|
35
|
+
project,
|
|
36
|
+
"projects",
|
|
37
|
+
project.keys(),
|
|
38
|
+
["id"],
|
|
39
|
+
form_unique_key="project-settings",
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
_, col2, col3 = st.columns([50, 25, 25])
|
|
43
|
+
if col2.button("Test Observability Connection", use_container_width=False):
|
|
44
|
+
status = st.empty()
|
|
45
|
+
status.info("Testing your connection to DataKitchen Observability...")
|
|
46
|
+
try:
|
|
47
|
+
project_code = project["project_code"]
|
|
48
|
+
api_url = project["observability_api_url"]
|
|
49
|
+
api_key = project["observability_api_key"]
|
|
50
|
+
test_observability_exporter(project_code, api_url, api_key)
|
|
51
|
+
status.empty()
|
|
52
|
+
status.success("The Observability connection test was successful.")
|
|
53
|
+
except Exception as e:
|
|
54
|
+
status.empty()
|
|
55
|
+
status.error("An error occurred during the Observability connection test.")
|
|
56
|
+
error_message = e.args[0]
|
|
57
|
+
st.text_area("Error Details", value=error_message)
|
|
58
|
+
|
|
59
|
+
view_log_file(col3)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@st.cache_data(show_spinner=False)
|
|
63
|
+
def get_current_project(code: str):
|
|
64
|
+
if not code:
|
|
65
|
+
return None
|
|
66
|
+
return query_service.get_project_by_code(session.dbschema, code)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def set_add_new_project():
|
|
70
|
+
session.add_project = True
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def set_edit_current_project():
|
|
74
|
+
session.add_project = False
|