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.
Files changed (270) hide show
  1. dataops_testgen-2.2.0.dist-info/LICENSE +203 -0
  2. dataops_testgen-2.2.0.dist-info/METADATA +287 -0
  3. dataops_testgen-2.2.0.dist-info/NOTICE +5 -0
  4. dataops_testgen-2.2.0.dist-info/RECORD +270 -0
  5. dataops_testgen-2.2.0.dist-info/WHEEL +5 -0
  6. dataops_testgen-2.2.0.dist-info/entry_points.txt +2 -0
  7. dataops_testgen-2.2.0.dist-info/top_level.txt +1 -0
  8. testgen/__init__.py +0 -0
  9. testgen/__main__.py +770 -0
  10. testgen/commands/__init__.py +0 -0
  11. testgen/commands/queries/__init__.py +0 -0
  12. testgen/commands/queries/execute_cat_tests_query.py +95 -0
  13. testgen/commands/queries/execute_tests_query.py +160 -0
  14. testgen/commands/queries/generate_tests_query.py +94 -0
  15. testgen/commands/queries/profiling_query.py +366 -0
  16. testgen/commands/queries/test_parameter_validation_query.py +88 -0
  17. testgen/commands/run_execute_cat_tests.py +162 -0
  18. testgen/commands/run_execute_tests.py +168 -0
  19. testgen/commands/run_generate_tests.py +107 -0
  20. testgen/commands/run_get_entities.py +122 -0
  21. testgen/commands/run_launch_db_config.py +84 -0
  22. testgen/commands/run_observability_exporter.py +330 -0
  23. testgen/commands/run_profiling_bridge.py +495 -0
  24. testgen/commands/run_quick_start.py +168 -0
  25. testgen/commands/run_setup_profiling_tools.py +96 -0
  26. testgen/commands/run_test_definition.py +146 -0
  27. testgen/commands/run_test_parameter_validation.py +135 -0
  28. testgen/commands/run_upgrade_db_config.py +156 -0
  29. testgen/common/__init__.py +8 -0
  30. testgen/common/clean_sql.py +53 -0
  31. testgen/common/credentials.py +25 -0
  32. testgen/common/database/__init__.py +0 -0
  33. testgen/common/database/database_service.py +629 -0
  34. testgen/common/database/flavor/__init__.py +0 -0
  35. testgen/common/database/flavor/flavor_service.py +75 -0
  36. testgen/common/database/flavor/mssql_flavor_service.py +34 -0
  37. testgen/common/database/flavor/postgresql_flavor_service.py +5 -0
  38. testgen/common/database/flavor/redshift_flavor_service.py +22 -0
  39. testgen/common/database/flavor/snowflake_flavor_service.py +69 -0
  40. testgen/common/database/flavor/trino_flavor_service.py +21 -0
  41. testgen/common/date_service.py +68 -0
  42. testgen/common/display_service.py +85 -0
  43. testgen/common/docker_service.py +76 -0
  44. testgen/common/encrypt.py +55 -0
  45. testgen/common/get_pipeline_parms.py +57 -0
  46. testgen/common/logs.py +79 -0
  47. testgen/common/process_service.py +62 -0
  48. testgen/common/read_file.py +69 -0
  49. testgen/settings.py +440 -0
  50. testgen/template/dbsetup/010_create_base_schema.sql +2 -0
  51. testgen/template/dbsetup/020_create_standard_functions_sprocs.sql +179 -0
  52. testgen/template/dbsetup/030_initialize_new_schema_structure.sql +735 -0
  53. testgen/template/dbsetup/040_populate_new_schema_project.sql +59 -0
  54. testgen/template/dbsetup/050_populate_new_schema_metadata.sql +1517 -0
  55. testgen/template/dbsetup/060_create_standard_views.sql +248 -0
  56. testgen/template/dbsetup/070_create_default_users.sql +17 -0
  57. testgen/template/dbsetup/075_grant_role_rights.sql +43 -0
  58. testgen/template/dbsetup/080_set_current_revision.sql +5 -0
  59. testgen/template/dbupgrade/0100_incremental_upgrade.sql +5 -0
  60. testgen/template/dbupgrade/0101_incremental_upgrade.sql +15 -0
  61. testgen/template/dbupgrade/0102_incremental_upgrade.sql +4 -0
  62. testgen/template/dbupgrade/0103_incremental_upgrade.sql +22 -0
  63. testgen/template/dbupgrade/0104_incremental_upgrade.sql +44 -0
  64. testgen/template/dbupgrade/0105_incremental_upgrade.sql +1 -0
  65. testgen/template/dbupgrade/0106_incremental_upgrade.sql +5 -0
  66. testgen/template/dbupgrade/0107_incremental_upgrade.sql +3 -0
  67. testgen/template/dbupgrade_helpers/get_tg_revision.sql +2 -0
  68. testgen/template/exec_cat_tests/ex_cat_build_agg_table_tests.sql +116 -0
  69. testgen/template/exec_cat_tests/ex_cat_get_distinct_tables.sql +11 -0
  70. testgen/template/exec_cat_tests/ex_cat_results_parse.sql +69 -0
  71. testgen/template/exec_cat_tests/ex_cat_retrieve_agg_test_parms.sql +6 -0
  72. testgen/template/exec_cat_tests/ex_cat_test_query.sql +8 -0
  73. testgen/template/execution/ex_finalize_test_run_results.sql +37 -0
  74. testgen/template/execution/ex_get_tests_non_cat.sql +47 -0
  75. testgen/template/execution/ex_update_test_record_in_testrun_table.sql +27 -0
  76. testgen/template/execution/ex_write_test_record_to_testrun_table.sql +6 -0
  77. testgen/template/flavors/generic/exec_query_tests/ex_aggregate_match_no_drops_generic.sql +48 -0
  78. testgen/template/flavors/generic/exec_query_tests/ex_aggregate_match_num_incr_generic.sql +34 -0
  79. testgen/template/flavors/generic/exec_query_tests/ex_aggregate_match_percent_above_generic.sql +49 -0
  80. testgen/template/flavors/generic/exec_query_tests/ex_aggregate_match_percent_within_generic.sql +49 -0
  81. testgen/template/flavors/generic/exec_query_tests/ex_aggregate_match_same_generic.sql +49 -0
  82. testgen/template/flavors/generic/exec_query_tests/ex_custom_query_generic.sql +39 -0
  83. testgen/template/flavors/generic/exec_query_tests/ex_data_match_2way_generic.sql +58 -0
  84. testgen/template/flavors/generic/exec_query_tests/ex_data_match_generic.sql +44 -0
  85. testgen/template/flavors/generic/exec_query_tests/ex_prior_match_generic.sql +37 -0
  86. testgen/template/flavors/generic/exec_query_tests/ex_relative_entropy_generic.sql +53 -0
  87. testgen/template/flavors/generic/exec_query_tests/ex_window_match_no_drops_generic.sql +46 -0
  88. testgen/template/flavors/generic/exec_query_tests/ex_window_match_same_generic.sql +59 -0
  89. testgen/template/flavors/generic/profiling/contingency_counts.sql +3 -0
  90. testgen/template/flavors/generic/validate_tests/ex_get_project_column_list_generic.sql +3 -0
  91. testgen/template/flavors/mssql/exec_query_tests/ex_relative_entropy_mssql.sql +53 -0
  92. testgen/template/flavors/mssql/profiling/project_ddf_query_mssql.sql +35 -0
  93. testgen/template/flavors/mssql/profiling/project_profiling_query_mssql.yaml +246 -0
  94. testgen/template/flavors/mssql/profiling/project_secondary_profiling_query_mssql.sql +36 -0
  95. testgen/template/flavors/mssql/setup_profiling_tools/00_drop_existing_functions_mssql.sql +8 -0
  96. testgen/template/flavors/mssql/setup_profiling_tools/01_create_functions_mssql.sql +12 -0
  97. testgen/template/flavors/mssql/setup_profiling_tools/02_create_functions_mssql.sql +54 -0
  98. testgen/template/flavors/mssql/setup_profiling_tools/create_qc_schema_mssql.sql +4 -0
  99. testgen/template/flavors/mssql/setup_profiling_tools/grant_execute_privileges_mssql.sql +1 -0
  100. testgen/template/flavors/postgresql/exec_query_tests/ex_window_match_no_drops_postgresql.sql +46 -0
  101. testgen/template/flavors/postgresql/exec_query_tests/ex_window_match_same_postgresql.sql +59 -0
  102. testgen/template/flavors/postgresql/profiling/project_ddf_query_postgresql.sql +42 -0
  103. testgen/template/flavors/postgresql/profiling/project_profiling_query_postgresql.yaml +225 -0
  104. testgen/template/flavors/postgresql/profiling/project_secondary_profiling_query_postgresql.sql +28 -0
  105. testgen/template/flavors/postgresql/setup_profiling_tools/create_functions_postgresql.sql +157 -0
  106. testgen/template/flavors/postgresql/setup_profiling_tools/create_qc_schema_postgresql.sql +1 -0
  107. testgen/template/flavors/postgresql/setup_profiling_tools/grant_execute_privileges_postgresql.sql +2 -0
  108. testgen/template/flavors/redshift/profiling/project_ddf_query_redshift.sql +38 -0
  109. testgen/template/flavors/redshift/profiling/project_profiling_query_redshift.yaml +221 -0
  110. testgen/template/flavors/redshift/profiling/project_secondary_profiling_query_redshift.sql +29 -0
  111. testgen/template/flavors/redshift/setup_profiling_tools/create_functions_redshift.sql +115 -0
  112. testgen/template/flavors/redshift/setup_profiling_tools/create_qc_schema_redshift.sql +1 -0
  113. testgen/template/flavors/redshift/setup_profiling_tools/grant_execute_privileges_redshift.sql +2 -0
  114. testgen/template/flavors/snowflake/profiling/project_ddf_query_snowflake.sql +38 -0
  115. testgen/template/flavors/snowflake/profiling/project_profiling_query_snowflake.yaml +220 -0
  116. testgen/template/flavors/snowflake/profiling/project_secondary_profiling_query_snowflake.sql +29 -0
  117. testgen/template/flavors/snowflake/setup_profiling_tools/create_functions_snowflake.sql +69 -0
  118. testgen/template/flavors/snowflake/setup_profiling_tools/create_qc_schema_snowflake.sql +1 -0
  119. testgen/template/flavors/snowflake/setup_profiling_tools/grant_execute_privileges_snowflake.sql +6 -0
  120. testgen/template/flavors/trino/profiling/project_profiling_query_trino.yaml +219 -0
  121. testgen/template/flavors/trino/setup_profiling_tools/create_functions_trino.sql +92 -0
  122. testgen/template/flavors/trino/setup_profiling_tools/create_qc_schema_trino.sql +1 -0
  123. testgen/template/gen_funny_cat_tests/gen_test_constant.sql +104 -0
  124. testgen/template/gen_funny_cat_tests/gen_test_distinct_value_ct.sql +98 -0
  125. testgen/template/gen_funny_cat_tests/gen_test_row_ct.sql +57 -0
  126. testgen/template/gen_funny_cat_tests/gen_test_row_ct_pct.sql +59 -0
  127. testgen/template/generation/gen_delete_old_tests.sql +5 -0
  128. testgen/template/generation/gen_insert_test_suite.sql +5 -0
  129. testgen/template/generation/gen_retrieve_or_insert_test_suite.sql +58 -0
  130. testgen/template/generation/gen_standard_test_type_list.sql +13 -0
  131. testgen/template/generation/gen_standard_tests.sql +48 -0
  132. testgen/template/get_entities/get_connection.sql +21 -0
  133. testgen/template/get_entities/get_connections_list.sql +9 -0
  134. testgen/template/get_entities/get_latest.sql +4 -0
  135. testgen/template/get_entities/get_profile.sql +12 -0
  136. testgen/template/get_entities/get_profile_info.sql +17 -0
  137. testgen/template/get_entities/get_profile_list.sql +17 -0
  138. testgen/template/get_entities/get_profile_screen.sql +275 -0
  139. testgen/template/get_entities/get_project_list.sql +6 -0
  140. testgen/template/get_entities/get_table_group_list.sql +10 -0
  141. testgen/template/get_entities/get_test_generation_list.sql +18 -0
  142. testgen/template/get_entities/get_test_info.sql +41 -0
  143. testgen/template/get_entities/get_test_results_for_run_cli.sql +16 -0
  144. testgen/template/get_entities/get_test_run_list.sql +24 -0
  145. testgen/template/get_entities/get_test_suite.sql +13 -0
  146. testgen/template/get_entities/get_test_suite_list.sql +18 -0
  147. testgen/template/get_entities/list_test_types.sql +4 -0
  148. testgen/template/observability/get_event_data.sql +23 -0
  149. testgen/template/observability/get_test_results.sql +41 -0
  150. testgen/template/observability/update_test_results_exported_to_observability.sql +12 -0
  151. testgen/template/parms/parms_profiling.sql +34 -0
  152. testgen/template/parms/parms_test_execution.sql +13 -0
  153. testgen/template/parms/parms_test_gen.sql +23 -0
  154. testgen/template/profiling/contingency_columns.sql +7 -0
  155. testgen/template/profiling/datatype_suggestions.sql +56 -0
  156. testgen/template/profiling/functional_datatype.sql +523 -0
  157. testgen/template/profiling/functional_tabletype_stage.sql +48 -0
  158. testgen/template/profiling/functional_tabletype_update.sql +8 -0
  159. testgen/template/profiling/pii_flag.sql +133 -0
  160. testgen/template/profiling/profile_anomalies_screen_column.sql +22 -0
  161. testgen/template/profiling/profile_anomalies_screen_multi_column.sql +58 -0
  162. testgen/template/profiling/profile_anomalies_screen_table.sql +22 -0
  163. testgen/template/profiling/profile_anomalies_screen_table_dates.sql +30 -0
  164. testgen/template/profiling/profile_anomalies_screen_variants.sql +40 -0
  165. testgen/template/profiling/profile_anomaly_types_get.sql +3 -0
  166. testgen/template/profiling/project_get_table_sample_count.sql +22 -0
  167. testgen/template/profiling/project_profile_run_record_insert.sql +8 -0
  168. testgen/template/profiling/project_profile_run_record_update.sql +5 -0
  169. testgen/template/profiling/project_profile_run_record_update_status.sql +5 -0
  170. testgen/template/profiling/project_update_profile_results_to_estimates.sql +32 -0
  171. testgen/template/profiling/refresh_anomalies.sql +33 -0
  172. testgen/template/profiling/refresh_data_chars_from_profiling.sql +156 -0
  173. testgen/template/profiling/secondary_profiling_columns.sql +12 -0
  174. testgen/template/profiling/secondary_profiling_delete.sql +4 -0
  175. testgen/template/profiling/secondary_profiling_update.sql +18 -0
  176. testgen/template/quick_start/populate_target_data.sql +1077 -0
  177. testgen/template/quick_start/recreate_target_data_schema.sql +167 -0
  178. testgen/template/quick_start/update_target_data.sql +100 -0
  179. testgen/template/updates/create_tmp_test_definition.sql +19 -0
  180. testgen/template/updates/get_test_def_parms.sql +38 -0
  181. testgen/template/updates/populate_stg_test_definitions.sql +184 -0
  182. testgen/template/validate_tests/ex_disable_tests_test_definitions.sql +5 -0
  183. testgen/template/validate_tests/ex_flag_tests_test_definitions.sql +64 -0
  184. testgen/template/validate_tests/ex_get_project_column_list_generic.sql +3 -0
  185. testgen/template/validate_tests/ex_get_test_column_list_tg.sql +65 -0
  186. testgen/template/validate_tests/ex_write_test_val_errors.sql +22 -0
  187. testgen/ui/__init__.py +0 -0
  188. testgen/ui/app.py +98 -0
  189. testgen/ui/assets/dk_logo.svg +46 -0
  190. testgen/ui/assets/question_mark.png +0 -0
  191. testgen/ui/assets/scripts.js +68 -0
  192. testgen/ui/assets/style.css +140 -0
  193. testgen/ui/bootstrap.py +109 -0
  194. testgen/ui/components/__init__.py +0 -0
  195. testgen/ui/components/frontend/css/KFOlCnqEu92Fr1MmEU9fBBc4.woff2 +0 -0
  196. testgen/ui/components/frontend/css/KFOlCnqEu92Fr1MmEU9fChc4EsA.woff2 +0 -0
  197. testgen/ui/components/frontend/css/KFOmCnqEu92Fr1Mu4mxK.woff2 +0 -0
  198. testgen/ui/components/frontend/css/KFOmCnqEu92Fr1Mu7GxKOzY.woff2 +0 -0
  199. testgen/ui/components/frontend/css/material-symbols-rounded.css +24 -0
  200. testgen/ui/components/frontend/css/material-symbols-rounded.woff2 +0 -0
  201. testgen/ui/components/frontend/css/roboto-font-faces.css +35 -0
  202. testgen/ui/components/frontend/css/shared.css +36 -0
  203. testgen/ui/components/frontend/img/dk_logo.svg +46 -0
  204. testgen/ui/components/frontend/index.html +17 -0
  205. testgen/ui/components/frontend/js/components/breadcrumbs.js +86 -0
  206. testgen/ui/components/frontend/js/components/button.js +66 -0
  207. testgen/ui/components/frontend/js/components/location.js +62 -0
  208. testgen/ui/components/frontend/js/components/select.js +75 -0
  209. testgen/ui/components/frontend/js/components/sidebar.js +358 -0
  210. testgen/ui/components/frontend/js/main.js +99 -0
  211. testgen/ui/components/frontend/js/streamlit.js +19 -0
  212. testgen/ui/components/frontend/js/van.min.js +1 -0
  213. testgen/ui/components/utils/__init__.py +0 -0
  214. testgen/ui/components/utils/callbacks.py +51 -0
  215. testgen/ui/components/utils/component.py +13 -0
  216. testgen/ui/components/widgets/__init__.py +6 -0
  217. testgen/ui/components/widgets/breadcrumbs.py +32 -0
  218. testgen/ui/components/widgets/location.py +65 -0
  219. testgen/ui/components/widgets/modal.py +97 -0
  220. testgen/ui/components/widgets/sidebar.py +69 -0
  221. testgen/ui/navigation/__init__.py +0 -0
  222. testgen/ui/navigation/menu.py +42 -0
  223. testgen/ui/navigation/page.py +20 -0
  224. testgen/ui/navigation/router.py +63 -0
  225. testgen/ui/queries/__init__.py +0 -0
  226. testgen/ui/queries/authentication_queries.py +47 -0
  227. testgen/ui/queries/connection_queries.py +121 -0
  228. testgen/ui/queries/profiling_queries.py +148 -0
  229. testgen/ui/queries/project_queries.py +9 -0
  230. testgen/ui/queries/table_group_queries.py +186 -0
  231. testgen/ui/queries/test_definition_queries.py +270 -0
  232. testgen/ui/queries/test_run_queries.py +32 -0
  233. testgen/ui/queries/test_suite_queries.py +145 -0
  234. testgen/ui/scripts/__init__.py +0 -0
  235. testgen/ui/scripts/patch_streamlit.py +111 -0
  236. testgen/ui/services/__init__.py +0 -0
  237. testgen/ui/services/authentication_service.py +119 -0
  238. testgen/ui/services/connection_service.py +220 -0
  239. testgen/ui/services/database_service.py +282 -0
  240. testgen/ui/services/form_service.py +1008 -0
  241. testgen/ui/services/javascript_service.py +44 -0
  242. testgen/ui/services/query_service.py +316 -0
  243. testgen/ui/services/string_service.py +12 -0
  244. testgen/ui/services/table_group_service.py +130 -0
  245. testgen/ui/services/test_definition_service.py +117 -0
  246. testgen/ui/services/test_run_service.py +13 -0
  247. testgen/ui/services/test_suite_service.py +76 -0
  248. testgen/ui/services/toolbar_service.py +77 -0
  249. testgen/ui/session.py +46 -0
  250. testgen/ui/views/__init__.py +0 -0
  251. testgen/ui/views/app_log_modal.py +92 -0
  252. testgen/ui/views/connections.py +72 -0
  253. testgen/ui/views/connections_base.py +367 -0
  254. testgen/ui/views/login.py +40 -0
  255. testgen/ui/views/not_found.py +16 -0
  256. testgen/ui/views/overview.py +34 -0
  257. testgen/ui/views/profiling_anomalies.py +501 -0
  258. testgen/ui/views/profiling_details.py +335 -0
  259. testgen/ui/views/profiling_modal.py +40 -0
  260. testgen/ui/views/profiling_results.py +206 -0
  261. testgen/ui/views/profiling_summary.py +177 -0
  262. testgen/ui/views/project_settings.py +74 -0
  263. testgen/ui/views/table_groups.py +530 -0
  264. testgen/ui/views/test_definitions.py +1020 -0
  265. testgen/ui/views/test_results.py +908 -0
  266. testgen/ui/views/test_runs.py +195 -0
  267. testgen/ui/views/test_suites.py +545 -0
  268. testgen/utils/__init__.py +0 -0
  269. testgen/utils/plugins.py +17 -0
  270. testgen/utils/singleton.py +14 -0
@@ -0,0 +1,735 @@
1
+
2
+ SET SEARCH_PATH TO {SCHEMA_NAME};
3
+
4
+ -- ==============================================================================
5
+ -- | Create DB Objects
6
+ -- | This script should only be run for new schema -- no drops
7
+ -- ==============================================================================
8
+
9
+ CREATE SEQUENCE test_definitions_cat_test_id_seq;
10
+
11
+ CREATE SEQUENCE profile_results_dk_id_seq;
12
+
13
+ CREATE TABLE stg_secondary_profile_updates (
14
+ project_code VARCHAR(30),
15
+ schema_name VARCHAR(50),
16
+ run_date TIMESTAMP,
17
+ table_name VARCHAR(120),
18
+ column_name VARCHAR(120),
19
+ top_freq_values VARCHAR(1500),
20
+ distinct_value_hash VARCHAR(40)
21
+ );
22
+
23
+ CREATE TABLE stg_functional_table_updates (
24
+ project_code VARCHAR(30),
25
+ schema_name VARCHAR(50),
26
+ run_date TIMESTAMP,
27
+ table_name VARCHAR(120),
28
+ table_period VARCHAR(10),
29
+ table_type VARCHAR(11)
30
+ );
31
+
32
+ CREATE TABLE projects (
33
+ id UUID DEFAULT gen_random_uuid(),
34
+ project_code VARCHAR(30) NOT NULL
35
+ CONSTRAINT projects_project_code_pk
36
+ PRIMARY KEY,
37
+ project_name VARCHAR(50),
38
+ effective_from_date DATE,
39
+ effective_thru_date DATE,
40
+ observability_api_key TEXT,
41
+ observability_api_url TEXT DEFAULT ''
42
+ );
43
+
44
+ CREATE TABLE connections (
45
+ id UUID DEFAULT gen_random_uuid(),
46
+ project_code VARCHAR(30)
47
+ CONSTRAINT connections_projects_project_code_fk
48
+ REFERENCES projects,
49
+ connection_id BIGINT GENERATED ALWAYS AS IDENTITY
50
+ CONSTRAINT connections_connection_id_pk
51
+ PRIMARY KEY,
52
+ sql_flavor VARCHAR(30),
53
+ project_host VARCHAR(250),
54
+ project_port VARCHAR(5),
55
+ project_user VARCHAR(50),
56
+ project_db VARCHAR(100),
57
+ connection_name VARCHAR(40),
58
+ project_qc_schema VARCHAR(200),
59
+ project_pw_encrypted BYTEA,
60
+ max_threads INTEGER DEFAULT 4,
61
+ max_query_chars INTEGER,
62
+ url VARCHAR(200) default '',
63
+ connect_by_url BOOLEAN default FALSE,
64
+ connect_by_key BOOLEAN DEFAULT FALSE,
65
+ private_key BYTEA,
66
+ private_key_passphrase BYTEA
67
+ );
68
+
69
+ CREATE TABLE table_groups
70
+ (
71
+ id UUID DEFAULT gen_random_uuid(),
72
+ project_code VARCHAR(30)
73
+ CONSTRAINT table_groups_projects_project_code_fk
74
+ REFERENCES projects,
75
+ connection_id BIGINT
76
+ CONSTRAINT table_groups_connections_connection_id_fk
77
+ REFERENCES connections,
78
+ table_groups_name VARCHAR(100),
79
+ table_group_schema VARCHAR(100),
80
+ profiling_table_set VARCHAR(2000),
81
+ profiling_include_mask VARCHAR(2000),
82
+ profiling_exclude_mask VARCHAR(2000),
83
+ profile_id_column_mask VARCHAR(2000) DEFAULT '%id' :: VARCHAR(2000),
84
+ profile_sk_column_mask VARCHAR(150) DEFAULT '%_sk',
85
+ profile_use_sampling VARCHAR(3) DEFAULT 'N',
86
+ profile_sample_percent VARCHAR(3) DEFAULT '30',
87
+ profile_sample_min_count BIGINT DEFAULT 100000,
88
+ profiling_delay_days VARCHAR(3) DEFAULT '0' ,
89
+ profile_do_pair_rules VARCHAR(3) DEFAULT 'N',
90
+ profile_pair_rule_pct INTEGER DEFAULT 95,
91
+ data_source VARCHAR(40),
92
+ source_system VARCHAR(40),
93
+ data_location VARCHAR(40),
94
+ source_process VARCHAR(40),
95
+ business_domain VARCHAR(40),
96
+ stakeholder_group VARCHAR(40),
97
+ transform_level VARCHAR(40)
98
+ );
99
+
100
+ CREATE TABLE profiling_runs (
101
+ id UUID
102
+ CONSTRAINT pk_prun_id
103
+ PRIMARY KEY,
104
+ project_code VARCHAR(30) NOT NULL,
105
+ connection_id BIGINT NOT NULL,
106
+ table_groups_id UUID NOT NULL,
107
+ profiling_starttime TIMESTAMP,
108
+ profiling_endtime TIMESTAMP,
109
+ status VARCHAR(100) DEFAULT 'Running',
110
+ log_message VARCHAR,
111
+ table_ct BIGINT,
112
+ column_ct BIGINT,
113
+ anomaly_ct BIGINT,
114
+ anomaly_table_ct BIGINT,
115
+ anomaly_column_ct BIGINT,
116
+ process_id INTEGER
117
+ );
118
+
119
+ CREATE TABLE test_suites (
120
+ id UUID DEFAULT gen_random_uuid(),
121
+ project_code VARCHAR(30) NOT NULL,
122
+ test_suite VARCHAR(200) NOT NULL,
123
+ connection_id BIGINT
124
+ CONSTRAINT test_suites_connections_connection_id_fk
125
+ REFERENCES connections,
126
+ table_groups_id UUID,
127
+ test_suite_description VARCHAR(1000),
128
+ test_action VARCHAR(100),
129
+ severity VARCHAR(10),
130
+ export_to_observability VARCHAR(5) DEFAULT 'Y',
131
+ -- email_list VARCHAR(200),
132
+ -- email_slack VARCHAR(100),
133
+ -- wiki_link VARCHAR(200),
134
+ -- variation_link VARCHAR(200),
135
+ -- wiki_page_id BIGINT,
136
+ -- confluence_space VARCHAR(10),
137
+ test_suite_schema VARCHAR(100),
138
+ component_key VARCHAR(100),
139
+ component_type VARCHAR(100),
140
+ component_name VARCHAR(100),
141
+ CONSTRAINT test_suites_project_code_test_suite_pk
142
+ PRIMARY KEY (project_code, test_suite)
143
+ );
144
+
145
+ CREATE TABLE test_definitions (
146
+ id UUID DEFAULT gen_random_uuid(),
147
+ cat_test_id BIGINT GENERATED BY DEFAULT AS IDENTITY
148
+ CONSTRAINT test_definitions_cat_test_id_pk
149
+ PRIMARY KEY,
150
+ project_code VARCHAR(30),
151
+ table_groups_id UUID,
152
+ profile_run_id UUID,
153
+ test_type VARCHAR(200),
154
+ test_suite_id UUID,
155
+ test_suite VARCHAR(200),
156
+ test_description VARCHAR(1000),
157
+ test_action VARCHAR(100),
158
+ schema_name VARCHAR(100),
159
+ table_name VARCHAR(100),
160
+ column_name VARCHAR(500),
161
+ skip_errors INTEGER,
162
+ baseline_ct VARCHAR(1000),
163
+ baseline_unique_ct VARCHAR(1000),
164
+ baseline_value VARCHAR(1000),
165
+ baseline_value_ct VARCHAR(1000),
166
+ threshold_value VARCHAR(1000),
167
+ baseline_sum VARCHAR(1000),
168
+ baseline_avg VARCHAR(1000),
169
+ baseline_sd VARCHAR(1000),
170
+ subset_condition VARCHAR(500),
171
+ groupby_names VARCHAR(200),
172
+ having_condition VARCHAR(500),
173
+ window_date_column VARCHAR(100),
174
+ window_days INTEGER,
175
+ match_schema_name VARCHAR(100),
176
+ match_table_name VARCHAR(100),
177
+ match_column_names VARCHAR(200),
178
+ match_subset_condition VARCHAR(500),
179
+ match_groupby_names VARCHAR(200),
180
+ match_having_condition VARCHAR(500),
181
+ test_mode VARCHAR(20),
182
+ custom_query VARCHAR,
183
+ test_active VARCHAR(10) DEFAULT 'Y':: CHARACTER VARYING,
184
+ test_definition_status VARCHAR(200),
185
+ severity VARCHAR(10),
186
+ watch_level VARCHAR(10) DEFAULT 'WARN'::CHARACTER VARYING,
187
+ check_result VARCHAR(500),
188
+ lock_refresh VARCHAR(10) DEFAULT 'N' NOT NULL,
189
+ last_auto_gen_date TIMESTAMP,
190
+ profiling_as_of_date TIMESTAMP,
191
+ last_manual_update TIMESTAMP DEFAULT NULL,
192
+ export_to_observability VARCHAR(5),
193
+ CONSTRAINT test_definitions_test_suites_project_code_test_suite_fk
194
+ FOREIGN KEY (project_code, test_suite) REFERENCES test_suites
195
+ );
196
+
197
+ ALTER SEQUENCE test_definitions_cat_test_id_seq OWNED BY test_definitions.cat_test_id;
198
+
199
+ CREATE TABLE profile_results (
200
+ id UUID DEFAULT gen_random_uuid()
201
+ CONSTRAINT profile_results_id_pk
202
+ PRIMARY KEY,
203
+ dk_id BIGINT GENERATED ALWAYS AS IDENTITY,
204
+ -- CONSTRAINT profile_results_dk_id_pk
205
+ -- PRIMARY KEY,
206
+ project_code VARCHAR(30),
207
+ connection_id BIGINT
208
+ CONSTRAINT profile_results_connections_connection_id_fk
209
+ REFERENCES connections,
210
+ table_groups_id UUID,
211
+ profile_run_id UUID,
212
+ schema_name VARCHAR(50),
213
+ run_date TIMESTAMP,
214
+ table_name VARCHAR(120),
215
+ position INTEGER,
216
+ column_name VARCHAR(120),
217
+ column_type VARCHAR(50),
218
+ general_type VARCHAR(1),
219
+ record_ct BIGINT,
220
+ value_ct BIGINT,
221
+ distinct_value_ct BIGINT,
222
+ distinct_std_value_ct BIGINT,
223
+ null_value_ct BIGINT,
224
+ min_length INTEGER,
225
+ max_length INTEGER,
226
+ avg_length DOUBLE PRECISION,
227
+ zero_value_ct BIGINT,
228
+ zero_length_ct BIGINT,
229
+ lead_space_ct BIGINT,
230
+ quoted_value_ct BIGINT,
231
+ includes_digit_ct BIGINT,
232
+ filled_value_ct BIGINT,
233
+ min_text VARCHAR(1000),
234
+ max_text VARCHAR(1000),
235
+ numeric_ct BIGINT,
236
+ date_ct BIGINT,
237
+ top_patterns VARCHAR(1000),
238
+ top_freq_values VARCHAR(1500),
239
+ distinct_value_hash VARCHAR(40),
240
+ min_value DOUBLE PRECISION,
241
+ min_value_over_0 DOUBLE PRECISION,
242
+ max_value DOUBLE PRECISION,
243
+ avg_value DOUBLE PRECISION,
244
+ stdev_value DOUBLE PRECISION,
245
+ percentile_25 DOUBLE PRECISION,
246
+ percentile_50 DOUBLE PRECISION,
247
+ percentile_75 DOUBLE PRECISION,
248
+ fractional_sum NUMERIC(38, 6),
249
+ min_date TIMESTAMP,
250
+ max_date TIMESTAMP,
251
+ before_1yr_date_ct BIGINT,
252
+ before_5yr_date_ct BIGINT,
253
+ before_20yr_date_ct BIGINT,
254
+ within_1yr_date_ct BIGINT,
255
+ within_1mo_date_ct BIGINT,
256
+ future_date_ct BIGINT,
257
+ date_days_present BIGINT,
258
+ date_weeks_present BIGINT,
259
+ date_months_present BIGINT,
260
+ boolean_true_ct BIGINT,
261
+ datatype_suggestion VARCHAR(50),
262
+ distinct_pattern_ct BIGINT,
263
+ embedded_space_ct BIGINT,
264
+ avg_embedded_spaces DOUBLE PRECISION,
265
+ std_pattern_match VARCHAR(30),
266
+ pii_flag VARCHAR(50),
267
+ functional_data_type VARCHAR(50),
268
+ functional_table_type VARCHAR(50),
269
+ sample_ratio FLOAT
270
+ );
271
+
272
+ ALTER SEQUENCE profile_results_dk_id_seq OWNED BY profile_results.dk_id;
273
+
274
+
275
+ CREATE TABLE profile_anomaly_types (
276
+ id VARCHAR(10) NOT NULL
277
+ CONSTRAINT pk_anomaly_types_id
278
+ PRIMARY KEY,
279
+ anomaly_type VARCHAR(200) NOT NULL,
280
+ data_object VARCHAR(10), -- Table, Dates, Column
281
+ anomaly_name VARCHAR(100),
282
+ anomaly_description VARCHAR(500),
283
+ anomaly_criteria VARCHAR(2000),
284
+ detail_expression VARCHAR(2000),
285
+ issue_likelihood VARCHAR(50), -- Potential, Likely, Certain
286
+ suggested_action VARCHAR(1000) -- Consider, Investigate, Correct
287
+ );
288
+
289
+ CREATE TABLE profile_anomaly_results (
290
+ id UUID DEFAULT gen_random_uuid() NOT NULL
291
+ CONSTRAINT pk_anomaly_results_id
292
+ PRIMARY KEY,
293
+ project_code VARCHAR(30),
294
+ table_groups_id UUID,
295
+ profile_run_id UUID,
296
+ column_id UUID,
297
+ schema_name VARCHAR(50),
298
+ table_name VARCHAR(120),
299
+ column_name VARCHAR(500),
300
+ column_type VARCHAR(50),
301
+ anomaly_id VARCHAR(10),
302
+ detail VARCHAR,
303
+ disposition VARCHAR(20) -- Confirmed, Dismissed, Inactive
304
+ );
305
+
306
+
307
+ CREATE TABLE profile_pair_rules (
308
+ id UUID DEFAULT gen_random_uuid() NOT NULL
309
+ CONSTRAINT pk_profile_pair_rules_id
310
+ PRIMARY KEY,
311
+ profile_run_id UUID,
312
+ schema_name VARCHAR(50),
313
+ table_name VARCHAR(120),
314
+ cause_column_name VARCHAR(500),
315
+ cause_column_value VARCHAR,
316
+ effect_column_name VARCHAR(500),
317
+ effect_column_value VARCHAR,
318
+ pair_count BIGINT,
319
+ cause_column_total BIGINT,
320
+ effect_column_total BIGINT,
321
+ rule_ratio DECIMAL(6, 4)
322
+ );
323
+
324
+
325
+ CREATE TABLE execution_queue (
326
+ execution_id BIGINT GENERATED ALWAYS AS IDENTITY
327
+ CONSTRAINT execution_queue_execution_id_pk
328
+ PRIMARY KEY,
329
+ project_code VARCHAR(30)
330
+ CONSTRAINT execution_queue_projects_project_code_fk
331
+ REFERENCES projects,
332
+ pipeline VARCHAR(20),
333
+ test_suite VARCHAR(200),
334
+ connection_id BIGINT
335
+ CONSTRAINT execution_queue_connections_connection_id_fk
336
+ REFERENCES connections,
337
+ schedule_datetime INTEGER,
338
+ execution_datetime TIMESTAMP,
339
+ execution_status VARCHAR(10),
340
+ order_run_number VARCHAR(50),
341
+ CONSTRAINT execution_queue_test_suites_project_code_test_suite_fk
342
+ FOREIGN KEY (project_code, test_suite) REFERENCES test_suites
343
+ );
344
+
345
+ CREATE TABLE data_structure_log (
346
+ project_code VARCHAR(30),
347
+ connection_id BIGINT,
348
+ change_date TIMESTAMP,
349
+ schema_name VARCHAR(50),
350
+ table_name VARCHAR(100),
351
+ ordinal_position INTEGER,
352
+ column_name VARCHAR(100),
353
+ data_type VARCHAR(50),
354
+ status VARCHAR(10)
355
+ );
356
+
357
+ CREATE TABLE data_table_chars (
358
+ table_id UUID DEFAULT gen_random_uuid(),
359
+ table_groups_id UUID,
360
+ schema_name VARCHAR(50),
361
+ table_name VARCHAR(120),
362
+ functional_table_type VARCHAR(50),
363
+ critical_data_element BOOLEAN,
364
+ data_source VARCHAR(40),
365
+ source_system VARCHAR(40),
366
+ source_process VARCHAR(40),
367
+ business_domain VARCHAR(40),
368
+ stakeholder_group VARCHAR(40),
369
+ transform_level VARCHAR(40),
370
+ aggregation_level VARCHAR(40),
371
+ add_date TIMESTAMP,
372
+ drop_date TIMESTAMP,
373
+ record_ct BIGINT,
374
+ column_ct BIGINT,
375
+ data_point_ct BIGINT
376
+ );
377
+
378
+ CREATE TABLE data_column_chars (
379
+ column_id UUID DEFAULT gen_random_uuid(),
380
+ table_id UUID,
381
+ table_groups_id UUID,
382
+ schema_name VARCHAR(50),
383
+ table_name VARCHAR(120),
384
+ column_name VARCHAR(120),
385
+ general_type VARCHAR(1),
386
+ column_type VARCHAR(50),
387
+ functional_data_type VARCHAR(50),
388
+ critical_data_element BOOLEAN,
389
+ data_source VARCHAR(40),
390
+ source_system VARCHAR(40),
391
+ source_process VARCHAR(40),
392
+ business_domain VARCHAR(40),
393
+ stakeholder_group VARCHAR(40),
394
+ transform_level VARCHAR(40),
395
+ aggregation_level VARCHAR(40),
396
+ add_date TIMESTAMP,
397
+ last_mod_date TIMESTAMP,
398
+ drop_date TIMESTAMP,
399
+ test_ct INTEGER,
400
+ last_test_date TIMESTAMP,
401
+ tests_last_run INTEGER,
402
+ tests_7_days_prior INTEGER,
403
+ tests_30_days_prior INTEGER,
404
+ fails_last_run INTEGER,
405
+ fails_7_days_prior INTEGER,
406
+ fails_30_days_prior INTEGER,
407
+ warnings_last_run INTEGER,
408
+ warnings_7_days_prior INTEGER,
409
+ warnings_30_days_prior INTEGER
410
+ );
411
+
412
+ CREATE TABLE working_agg_cat_tests (
413
+ project_code VARCHAR(30),
414
+ test_run_id VARCHAR(100) NOT NULL,
415
+ test_suite VARCHAR(200),
416
+ schema_name VARCHAR(200) NOT NULL,
417
+ table_name VARCHAR(200) NOT NULL,
418
+ cat_sequence INTEGER NOT NULL,
419
+ test_count INTEGER,
420
+ test_time TIMESTAMP,
421
+ start_time TIMESTAMP,
422
+ end_time TIMESTAMP,
423
+ column_names TEXT,
424
+ test_types TEXT,
425
+ test_definition_ids TEXT,
426
+ test_actions TEXT,
427
+ test_descriptions TEXT,
428
+ test_parms TEXT,
429
+ test_measures TEXT,
430
+ test_conditions TEXT,
431
+ CONSTRAINT working_agg_cat_tests_trid_sn_tn_cs
432
+ PRIMARY KEY (test_run_id, schema_name, table_name, cat_sequence)
433
+ );
434
+
435
+ CREATE TABLE working_agg_cat_results (
436
+ project_code VARCHAR(30),
437
+ test_run_id VARCHAR(100) NOT NULL,
438
+ test_suite VARCHAR(200),
439
+ schema_name VARCHAR(200) NOT NULL,
440
+ table_name VARCHAR(200) NOT NULL,
441
+ cat_sequence INTEGER NOT NULL,
442
+ measure_results TEXT,
443
+ test_results TEXT,
444
+ CONSTRAINT working_agg_cat_results_tri_sn_tn_cs
445
+ PRIMARY KEY (test_run_id, schema_name, table_name, cat_sequence)
446
+ );
447
+
448
+ CREATE TABLE test_types (
449
+ id VARCHAR,
450
+ test_type VARCHAR(200) NOT NULL
451
+ CONSTRAINT cat_tests_test_type_pk
452
+ PRIMARY KEY,
453
+ test_name_short VARCHAR(30),
454
+ test_name_long VARCHAR(100),
455
+ test_description VARCHAR(1000),
456
+ except_message VARCHAR(1000),
457
+ measure_uom VARCHAR(100),
458
+ measure_uom_description VARCHAR(200),
459
+ selection_criteria TEXT,
460
+ column_name_prompt TEXT,
461
+ column_name_help TEXT,
462
+ default_parm_columns TEXT,
463
+ default_parm_values TEXT,
464
+ default_parm_prompts TEXT,
465
+ default_parm_help TEXT,
466
+ default_severity VARCHAR(10),
467
+ run_type VARCHAR(10),
468
+ test_scope VARCHAR,
469
+ dq_dimension VARCHAR(50),
470
+ health_dimension VARCHAR(50),
471
+ threshold_description VARCHAR(200),
472
+ usage_notes VARCHAR,
473
+ active VARCHAR
474
+ );
475
+
476
+ CREATE TABLE test_templates (
477
+ id VARCHAR,
478
+ test_type VARCHAR(200) NOT NULL
479
+ CONSTRAINT test_templates_test_types_test_type_fk
480
+ REFERENCES test_types,
481
+ sql_flavor VARCHAR(20) NOT NULL,
482
+ template_name VARCHAR(400),
483
+ CONSTRAINT test_templates_test_type_sql_flavor_pk
484
+ PRIMARY KEY (test_type, sql_flavor)
485
+ );
486
+
487
+ CREATE TABLE generation_sets (
488
+ generation_set VARCHAR,
489
+ test_type VARCHAR,
490
+ CONSTRAINT generation_sets_gen_set_test_type_pk
491
+ PRIMARY KEY (generation_set, test_type)
492
+ );
493
+
494
+ CREATE TABLE test_runs (
495
+ id UUID NOT NULL
496
+ CONSTRAINT test_runs_id_pk
497
+ PRIMARY KEY,
498
+ project_code VARCHAR(30),
499
+ test_suite VARCHAR(200),
500
+ test_starttime TIMESTAMP,
501
+ test_endtime TIMESTAMP,
502
+ status VARCHAR(100) DEFAULT 'Running',
503
+ log_message TEXT,
504
+ duration VARCHAR(50),
505
+ test_ct INTEGER,
506
+ passed_ct INTEGER,
507
+ failed_ct INTEGER,
508
+ warning_ct INTEGER,
509
+ error_ct INTEGER,
510
+ table_ct INTEGER,
511
+ column_ct INTEGER,
512
+ column_failed_ct INTEGER,
513
+ column_warning_ct INTEGER,
514
+ process_id INTEGER
515
+ );
516
+
517
+ CREATE TABLE test_results (
518
+ id UUID DEFAULT gen_random_uuid(),
519
+ result_id BIGINT GENERATED ALWAYS AS IDENTITY,
520
+ project_code VARCHAR(30),
521
+ test_type VARCHAR(50)
522
+ CONSTRAINT test_results_test_types_test_type_fk
523
+ REFERENCES test_types,
524
+ test_suite_id UUID,
525
+ test_suite VARCHAR(200),
526
+ test_definition_id UUID,
527
+ auto_gen BOOLEAN,
528
+ test_time TIMESTAMP,
529
+ starttime TIMESTAMP,
530
+ endtime TIMESTAMP,
531
+ schema_name VARCHAR(100),
532
+ table_name VARCHAR(100),
533
+ column_names VARCHAR(500),
534
+ skip_errors INTEGER,
535
+ input_parameters VARCHAR(1000),
536
+ result_code INTEGER,
537
+ severity VARCHAR(10),
538
+ result_status VARCHAR(10),
539
+ result_message VARCHAR(1000),
540
+ result_measure VARCHAR(1000),
541
+ threshold_value VARCHAR(1000),
542
+ result_error_data VARCHAR(4000),
543
+ test_action VARCHAR(100),
544
+ disposition VARCHAR(20),
545
+ subset_condition VARCHAR(500),
546
+ result_query VARCHAR(4000),
547
+ test_description VARCHAR(1000),
548
+ test_run_id UUID,
549
+ table_groups_id UUID,
550
+ observability_status VARCHAR(10),
551
+ -- exported_observability BOOLEAN NOT NULL DEFAULT FALSE,
552
+ CONSTRAINT test_results_test_suites_project_code_test_suite_fk
553
+ FOREIGN KEY (project_code, test_suite) REFERENCES test_suites
554
+ );
555
+
556
+
557
+ CREATE TABLE cat_test_conditions (
558
+ id VARCHAR,
559
+ test_type VARCHAR(200) NOT NULL
560
+ CONSTRAINT cat_test_conditions_cat_tests_test_type_fk
561
+ REFERENCES test_types,
562
+ sql_flavor VARCHAR(20) NOT NULL,
563
+ measure VARCHAR(2000),
564
+ test_operator VARCHAR(20),
565
+ test_condition VARCHAR(2000),
566
+ CONSTRAINT cat_test_conditions_test_type_sql_flavor_pk
567
+ PRIMARY KEY (test_type, sql_flavor)
568
+ );
569
+
570
+ CREATE TABLE target_data_lookups (
571
+ id VARCHAR,
572
+ test_id VARCHAR,
573
+ test_type VARCHAR(200) NOT NULL,
574
+ sql_flavor VARCHAR(20) NOT NULL,
575
+ lookup_type VARCHAR(10),
576
+ lookup_query VARCHAR,
577
+ error_type VARCHAR(30) NOT NULL
578
+ );
579
+
580
+ CREATE TABLE variant_codings (
581
+ value_type VARCHAR,
582
+ check_values VARCHAR
583
+ );
584
+
585
+ CREATE TABLE functional_test_results
586
+ (
587
+ test_name VARCHAR(50),
588
+ error_ct BIGINT
589
+ );
590
+
591
+ CREATE TABLE auth_users (
592
+ id UUID DEFAULT gen_random_uuid(),
593
+ username VARCHAR(20),
594
+ email VARCHAR(120),
595
+ name VARCHAR(120),
596
+ password VARCHAR(120),
597
+ preauthorized BOOLEAN default false,
598
+ role VARCHAR(20)
599
+ );
600
+
601
+ ALTER TABLE auth_users
602
+ ADD CONSTRAINT username_check
603
+ CHECK (
604
+ LENGTH(username) >= 4 AND -- Minimum length of 4 characters
605
+ LENGTH(username) <= 20 AND -- Maximum length of 20 characters
606
+ username ~ '^[a-zA-Z0-9_]+$' -- Only alphanumeric characters and underscores allowed
607
+ );
608
+
609
+ ALTER TABLE auth_users
610
+ ADD CONSTRAINT unique_username
611
+ UNIQUE (username);
612
+
613
+ CREATE TABLE tg_revision (
614
+ component VARCHAR(50) NOT NULL
615
+ CONSTRAINT tg_revision_component_pk
616
+ PRIMARY KEY,
617
+ revision INTEGER
618
+ );
619
+
620
+ -- Index working table - ORIGINAL
621
+ CREATE INDEX working_agg_cat_tests_test_run_id_index
622
+ ON working_agg_cat_tests(test_run_id);
623
+
624
+
625
+ -- Index Connections
626
+ CREATE UNIQUE INDEX uix_con_id
627
+ ON connections(id);
628
+
629
+ -- Index Table_Groups
630
+ CREATE UNIQUE INDEX uix_tg_id
631
+ ON table_groups(id);
632
+
633
+ CREATE INDEX ix_tg_cid
634
+ ON table_groups(connection_id);
635
+
636
+
637
+ -- Index Profile Results - ORIGINAL -- still relevant?
638
+ CREATE INDEX profile_results_tgid_sn_tn_cn
639
+ ON profile_results (table_groups_id, schema_name, table_name, column_name);
640
+
641
+
642
+ -- Index test_suites
643
+ CREATE UNIQUE INDEX uix_ts_id
644
+ ON test_suites(id);
645
+
646
+ CREATE INDEX ix_ts_con
647
+ ON test_suites(connection_id);
648
+
649
+ -- Index test_definitions
650
+ CREATE INDEX ix_td_pc_stc_tst
651
+ ON test_definitions(project_code, schema_name, table_name, column_name, test_type);
652
+
653
+ CREATE UNIQUE INDEX uix_td_id
654
+ ON test_definitions(id);
655
+
656
+ CREATE INDEX ix_td_tg
657
+ ON test_definitions(table_groups_id);
658
+
659
+ CREATE INDEX ix_td_ts_tc
660
+ ON test_definitions(test_suite_id, table_name, column_name, test_type);
661
+
662
+ -- Index test_runs
663
+ CREATE INDEX ix_trun_pc_ts_time
664
+ ON test_runs(project_code, test_suite, test_starttime);
665
+
666
+ CREATE INDEX ix_trun_time
667
+ ON test_runs USING BRIN (test_starttime);
668
+
669
+ -- Index test_results
670
+ CREATE UNIQUE INDEX uix_tr_id
671
+ ON test_results(id);
672
+
673
+ CREATE INDEX ix_tr_pc_ts
674
+ ON test_results(project_code, test_suite);
675
+
676
+ CREATE INDEX ix_tr_trun
677
+ ON test_results(test_run_id);
678
+
679
+ CREATE INDEX ix_tr_tt
680
+ ON test_results(test_type);
681
+
682
+ CREATE INDEX ix_tr_pc_sctc_tt
683
+ ON test_results(project_code, test_suite, schema_name, table_name, column_names, test_type);
684
+
685
+ CREATE INDEX ix_tr_ts_tctt
686
+ ON test_results(test_suite_id, table_name, column_names, test_type);
687
+
688
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
689
+ -- PROFILING OPTIMIZATION
690
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
691
+
692
+ -- Index profiling_runs
693
+ CREATE INDEX ix_prun_pc_con
694
+ ON profiling_runs(project_code, connection_id);
695
+
696
+ CREATE INDEX ix_prun_tg
697
+ ON profiling_runs(table_groups_id);
698
+
699
+
700
+ -- Index profile_anomaly_types
701
+ CREATE UNIQUE INDEX uix_pat_at
702
+ ON profile_anomaly_types(anomaly_type);
703
+
704
+
705
+ -- Index profile_results
706
+ CREATE INDEX ix_pr_prun
707
+ ON profile_results(profile_run_id);
708
+
709
+ CREATE INDEX ix_pr_pc_con
710
+ ON profile_results(project_code, connection_id);
711
+
712
+ CREATE UNIQUE INDEX uix_pr_tg_t_c_prun
713
+ ON profile_results(table_groups_id, table_name, column_name, profile_run_id);
714
+
715
+
716
+ -- Index profile_pair_rules
717
+ CREATE INDEX ix_pro_pair_prun
718
+ ON profile_pair_rules(profile_run_id);
719
+
720
+
721
+ -- Index profile_anomaly_results
722
+ CREATE INDEX ix_ares_prun
723
+ ON profile_anomaly_results(profile_run_id);
724
+
725
+ CREATE INDEX ix_ares_anid
726
+ ON profile_anomaly_results(anomaly_id);
727
+
728
+
729
+ -- Conditional index for Observability Export - ORIGINAL
730
+ CREATE INDEX cix_tr_pc_ts
731
+ ON test_results(project_code, test_suite) WHERE observability_status = 'Queued';
732
+
733
+
734
+ INSERT INTO tg_revision (component, revision)
735
+ VALUES ('metadata_db', 0);