Skip to content

Commit 40ec232

Browse files
Merge pull request #45 from DataKitchen/release/4.16.3
Release/4.16.3
2 parents 59b4a93 + 7628c85 commit 40ec232

61 files changed

Lines changed: 2035 additions & 1330 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"
88

99
[project]
1010
name = "dataops-testgen"
11-
version = "4.12.6"
11+
version = "4.16.3"
1212
description = "DataKitchen's Data Quality DataOps TestGen"
1313
authors = [
1414
{ "name" = "DataKitchen, Inc.", "email" = "info@datakitchen.io" },

testgen/commands/queries/generate_tests_query.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def ReplaceParms(self, strInputString):
4343
strInputString = strInputString.replace("{GENERATION_SET}", self.generation_set)
4444
strInputString = strInputString.replace("{AS_OF_DATE}", self.as_of_date)
4545
strInputString = strInputString.replace("{DATA_SCHEMA}", self.data_schema)
46+
strInputString = strInputString.replace("{ID_SEPARATOR}", "`" if self.sql_flavor == "databricks" else '"')
4647

4748
return strInputString
4849

testgen/commands/run_execute_cat_tests.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def ParseCATResults(clsCATExecute):
6363
RunActionQueryList("DKTG", [strQuery])
6464

6565

66-
def FinalizeTestRun(clsCATExecute: CCATExecutionSQL):
66+
def FinalizeTestRun(clsCATExecute: CCATExecutionSQL, username: str | None = None):
6767
_, row_counts = RunActionQueryList(("DKTG"), [
6868
clsCATExecute.FinalizeTestResultsSQL(),
6969
clsCATExecute.PushTestRunStatusUpdateSQL(),
@@ -89,6 +89,7 @@ def FinalizeTestRun(clsCATExecute: CCATExecutionSQL):
8989
MixpanelService().send_event(
9090
"run-tests",
9191
source=settings.ANALYTICS_JOB_SOURCE,
92+
username=username,
9293
sql_flavor=clsCATExecute.flavor,
9394
test_count=row_counts[0],
9495
run_duration=(end_time - date_service.parse_now(clsCATExecute.run_date)).total_seconds(),
@@ -97,7 +98,7 @@ def FinalizeTestRun(clsCATExecute: CCATExecutionSQL):
9798

9899

99100
def run_cat_test_queries(
100-
dctParms, strTestRunID, strTestTime, strProjectCode, strTestSuite, error_msg, minutes_offset=0, spinner=None
101+
dctParms, strTestRunID, strTestTime, strProjectCode, strTestSuite, error_msg, username=None, minutes_offset=0, spinner=None
101102
):
102103
booErrors = False
103104

@@ -167,4 +168,4 @@ def run_cat_test_queries(
167168

168169
finally:
169170
LOG.info("Finalizing test run")
170-
FinalizeTestRun(clsCATExecute)
171+
FinalizeTestRun(clsCATExecute, username)

testgen/commands/run_execute_tests.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
date_service,
1919
)
2020
from testgen.common.database.database_service import ExecuteDBQuery, empty_cache
21+
from testgen.ui.session import session
2122

2223
from .run_execute_cat_tests import run_cat_test_queries
2324
from .run_refresh_data_chars import run_refresh_data_chars_queries
@@ -109,7 +110,7 @@ def run_execution_steps_in_background(project_code, test_suite):
109110
empty_cache()
110111
background_thread = threading.Thread(
111112
target=run_execution_steps,
112-
args=(project_code, test_suite),
113+
args=(project_code, test_suite, session.username),
113114
)
114115
background_thread.start()
115116
else:
@@ -121,6 +122,7 @@ def run_execution_steps_in_background(project_code, test_suite):
121122
def run_execution_steps(
122123
project_code: str,
123124
test_suite: str,
125+
username: str | None = None,
124126
minutes_offset: int=0,
125127
spinner: Spinner=None,
126128
) -> str:
@@ -178,7 +180,7 @@ def run_execution_steps(
178180

179181
LOG.info("CurrentStep: Execute Step - CAT Test Execution")
180182
if run_cat_test_queries(
181-
test_exec_params, test_run_id, test_time, project_code, test_suite, error_msg, minutes_offset, spinner
183+
test_exec_params, test_run_id, test_time, project_code, test_suite, error_msg, username, minutes_offset, spinner
182184
):
183185
has_errors = True
184186

testgen/commands/run_get_entities.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import logging
22

33
from testgen.common import RetrieveDBResultsToList, read_template_sql_file
4-
from testgen.common.encrypt import DecryptText
54

65
LOG = logging.getLogger("testgen")
76

@@ -29,17 +28,6 @@ def run_list_connections():
2928
return RetrieveDBResultsToList("DKTG", sql_template)
3029

3130

32-
def run_get_connection(connection_id):
33-
sql_template = read_template_sql_file("get_connection.sql", "get_entities")
34-
sql_template = sql_template.replace("{CONNECTION_ID}", str(connection_id))
35-
rows, _ = RetrieveDBResultsToList("DKTG", sql_template)
36-
connection = rows.pop()._asdict()
37-
connection["password"] = DecryptText(connection["project_pw_encrypted"]) if connection["project_pw_encrypted"] else None
38-
connection["private_key"] = DecryptText(connection["private_key"]) if connection["private_key"] else None
39-
connection["private_key_passphrase"] = DecryptText(connection["private_key_passphrase"]) if connection["private_key_passphrase"] else ""
40-
return connection
41-
42-
4331
def run_table_group_list(project_code):
4432
sql_template = read_template_sql_file("get_table_group_list.sql", "get_entities")
4533
sql_template = sql_template.replace("{PROJECT_CODE}", project_code)

testgen/commands/run_profiling_bridge.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
)
2323
from testgen.common.database.database_service import empty_cache
2424
from testgen.common.mixpanel_service import MixpanelService
25+
from testgen.ui.session import session
2526

2627
booClean = True
2728
LOG = logging.getLogger("testgen")
@@ -238,7 +239,7 @@ def run_profiling_in_background(table_group_id):
238239
empty_cache()
239240
background_thread = threading.Thread(
240241
target=run_profiling_queries,
241-
args=(table_group_id,),
242+
args=(table_group_id, session.username),
242243
)
243244
background_thread.start()
244245
else:
@@ -247,7 +248,7 @@ def run_profiling_in_background(table_group_id):
247248
subprocess.Popen(script) # NOQA S603
248249

249250

250-
def run_profiling_queries(strTableGroupsID, spinner=None):
251+
def run_profiling_queries(strTableGroupsID, username=None, spinner=None):
251252
if strTableGroupsID is None:
252253
raise ValueError("Table Group ID was not specified")
253254

@@ -518,6 +519,7 @@ def run_profiling_queries(strTableGroupsID, spinner=None):
518519
MixpanelService().send_event(
519520
"run-profiling",
520521
source=settings.ANALYTICS_JOB_SOURCE,
522+
username=username,
521523
sql_flavor=clsProfiling.flavor,
522524
sampling=clsProfiling.profile_use_sampling == "Y",
523525
table_count=table_count,

testgen/template/dbsetup/030_initialize_new_schema_structure.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@ CREATE TABLE table_groups
101101
profile_use_sampling VARCHAR(3) DEFAULT 'N',
102102
profile_sample_percent VARCHAR(3) DEFAULT '30',
103103
profile_sample_min_count BIGINT DEFAULT 100000,
104-
profiling_delay_days VARCHAR(3) DEFAULT '0' ,
104+
profiling_delay_days VARCHAR(3) DEFAULT '0',
105105
profile_flag_cdes BOOLEAN DEFAULT TRUE,
106106
profile_do_pair_rules VARCHAR(3) DEFAULT 'N',
107107
profile_pair_rule_pct INTEGER DEFAULT 95,
108+
include_in_dashboard BOOLEAN DEFAULT TRUE,
108109
description VARCHAR(1000),
109110
data_source VARCHAR(40),
110111
source_system VARCHAR(40),

0 commit comments

Comments
 (0)