recce-nightly 1.2.0.20250506__py3-none-any.whl → 1.26.0.20251124__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.
Potentially problematic release.
This version of recce-nightly might be problematic. Click here for more details.
- recce/VERSION +1 -1
- recce/__init__.py +27 -22
- recce/adapter/base.py +11 -14
- recce/adapter/dbt_adapter/__init__.py +810 -480
- recce/adapter/dbt_adapter/dbt_version.py +3 -0
- recce/adapter/sqlmesh_adapter.py +24 -35
- recce/apis/check_api.py +39 -28
- recce/apis/check_func.py +33 -27
- recce/apis/run_api.py +25 -19
- recce/apis/run_func.py +29 -23
- recce/artifact.py +119 -51
- recce/cli.py +1299 -323
- recce/config.py +42 -33
- recce/connect_to_cloud.py +138 -0
- recce/core.py +55 -47
- recce/data/404.html +1 -1
- recce/data/__next.__PAGE__.txt +10 -0
- recce/data/__next._full.txt +23 -0
- recce/data/__next._head.txt +8 -0
- recce/data/__next._index.txt +8 -0
- recce/data/__next._tree.txt +5 -0
- recce/data/_next/static/52aV_JrNUZU6dMFgvTQEO/_buildManifest.js +11 -0
- recce/data/_next/static/52aV_JrNUZU6dMFgvTQEO/_clientMiddlewareManifest.json +1 -0
- recce/data/_next/static/chunks/02b996c7f6a29a06.js +4 -0
- recce/data/_next/static/chunks/19c10d219a6a21ff.js +1 -0
- recce/data/_next/static/chunks/2df9ec28a061971d.js +11 -0
- recce/data/_next/static/chunks/3098c987393bda15.js +1 -0
- recce/data/_next/static/chunks/393dc43e483f717a.css +2 -0
- recce/data/_next/static/chunks/399e8d91a7e45073.js +2 -0
- recce/data/_next/static/chunks/4d0186f631230245.js +1 -0
- recce/data/_next/static/chunks/5794ba9e10a9c060.js +11 -0
- recce/data/_next/static/chunks/715761c929a3f28b.js +110 -0
- recce/data/_next/static/chunks/71f88fcc615bf282.js +1 -0
- recce/data/_next/static/chunks/80d2a95eaf1201ea.js +1 -0
- recce/data/_next/static/chunks/9979c6109bbbee35.js +1 -0
- recce/data/_next/static/chunks/99d638224186c118.js +1 -0
- recce/data/_next/static/chunks/d003eb36240e92f3.js +1 -0
- recce/data/_next/static/chunks/d3167cdfec4fc351.js +1 -0
- recce/data/_next/static/chunks/e124bccf574a3361.css +1 -0
- recce/data/_next/static/chunks/f40141db1bdb46f0.css +6 -0
- recce/data/_next/static/chunks/fcc53a88741a52f9.js +1 -0
- recce/data/_next/static/chunks/turbopack-b1920d28cfb1f28d.js +3 -0
- recce/data/_next/static/media/favicon.a8d38d84.ico +0 -0
- recce/data/_next/static/media/montserrat-cyrillic-800-normal.d80d830d.woff2 +0 -0
- recce/data/_next/static/media/montserrat-cyrillic-800-normal.f9d58125.woff +0 -0
- recce/data/_next/static/media/montserrat-cyrillic-ext-800-normal.076c2a93.woff2 +0 -0
- recce/data/_next/static/media/montserrat-cyrillic-ext-800-normal.a4fa76b5.woff +0 -0
- recce/data/_next/static/media/montserrat-latin-800-normal.cde454cc.woff2 +0 -0
- recce/data/_next/static/media/montserrat-latin-800-normal.d5761935.woff +0 -0
- recce/data/_next/static/media/montserrat-latin-ext-800-normal.40ec0659.woff2 +0 -0
- recce/data/_next/static/media/montserrat-latin-ext-800-normal.b671449b.woff +0 -0
- recce/data/_next/static/media/montserrat-vietnamese-800-normal.9f7b8541.woff +0 -0
- recce/data/_next/static/media/montserrat-vietnamese-800-normal.f9eb854e.woff2 +0 -0
- recce/data/_next/static/media/reload-image.7aa931c7.svg +4 -0
- recce/data/_not-found/__next._full.txt +17 -0
- recce/data/_not-found/__next._head.txt +8 -0
- recce/data/_not-found/__next._index.txt +8 -0
- recce/data/_not-found/__next._not-found.__PAGE__.txt +5 -0
- recce/data/_not-found/__next._not-found.txt +4 -0
- recce/data/_not-found/__next._tree.txt +3 -0
- recce/data/_not-found.html +1 -0
- recce/data/_not-found.txt +17 -0
- recce/data/auth_callback.html +68 -0
- recce/data/imgs/reload-image.svg +4 -0
- recce/data/index.html +1 -27
- recce/data/index.txt +23 -7
- recce/diff.py +6 -12
- recce/event/__init__.py +86 -74
- recce/event/collector.py +33 -22
- recce/event/track.py +49 -27
- recce/exceptions.py +1 -1
- recce/git.py +7 -7
- recce/github.py +57 -53
- recce/mcp_server.py +716 -0
- recce/models/__init__.py +4 -1
- recce/models/check.py +6 -7
- recce/models/run.py +1 -0
- recce/models/types.py +131 -28
- recce/pull_request.py +27 -25
- recce/run.py +165 -121
- recce/server.py +303 -111
- recce/state/__init__.py +31 -0
- recce/state/cloud.py +632 -0
- recce/state/const.py +26 -0
- recce/state/local.py +56 -0
- recce/state/state.py +119 -0
- recce/state/state_loader.py +174 -0
- recce/summary.py +188 -143
- recce/tasks/__init__.py +19 -3
- recce/tasks/core.py +11 -13
- recce/tasks/dataframe.py +82 -18
- recce/tasks/histogram.py +69 -34
- recce/tasks/lineage.py +2 -2
- recce/tasks/profile.py +152 -86
- recce/tasks/query.py +139 -87
- recce/tasks/rowcount.py +37 -31
- recce/tasks/schema.py +18 -15
- recce/tasks/top_k.py +35 -35
- recce/tasks/valuediff.py +216 -152
- recce/util/__init__.py +3 -0
- recce/util/api_token.py +80 -0
- recce/util/breaking.py +87 -85
- recce/util/cll.py +274 -219
- recce/util/io.py +22 -17
- recce/util/lineage.py +65 -16
- recce/util/logger.py +1 -1
- recce/util/onboarding_state.py +45 -0
- recce/util/perf_tracking.py +85 -0
- recce/util/recce_cloud.py +322 -72
- recce/util/singleton.py +4 -4
- recce/yaml/__init__.py +7 -10
- recce_cloud/__init__.py +24 -0
- recce_cloud/api/__init__.py +17 -0
- recce_cloud/api/base.py +111 -0
- recce_cloud/api/client.py +150 -0
- recce_cloud/api/exceptions.py +26 -0
- recce_cloud/api/factory.py +63 -0
- recce_cloud/api/github.py +76 -0
- recce_cloud/api/gitlab.py +82 -0
- recce_cloud/artifact.py +57 -0
- recce_cloud/ci_providers/__init__.py +9 -0
- recce_cloud/ci_providers/base.py +82 -0
- recce_cloud/ci_providers/detector.py +147 -0
- recce_cloud/ci_providers/github_actions.py +136 -0
- recce_cloud/ci_providers/gitlab_ci.py +130 -0
- recce_cloud/cli.py +245 -0
- recce_cloud/upload.py +214 -0
- {recce_nightly-1.2.0.20250506.dist-info → recce_nightly-1.26.0.20251124.dist-info}/METADATA +68 -37
- recce_nightly-1.26.0.20251124.dist-info/RECORD +180 -0
- {recce_nightly-1.2.0.20250506.dist-info → recce_nightly-1.26.0.20251124.dist-info}/WHEEL +1 -1
- {recce_nightly-1.2.0.20250506.dist-info → recce_nightly-1.26.0.20251124.dist-info}/top_level.txt +1 -0
- tests/adapter/dbt_adapter/conftest.py +9 -5
- tests/adapter/dbt_adapter/dbt_test_helper.py +37 -22
- tests/adapter/dbt_adapter/test_dbt_adapter.py +0 -15
- tests/adapter/dbt_adapter/test_dbt_cll.py +656 -41
- tests/adapter/dbt_adapter/test_selector.py +22 -21
- tests/recce_cloud/__init__.py +0 -0
- tests/recce_cloud/test_ci_providers.py +351 -0
- tests/recce_cloud/test_cli.py +372 -0
- tests/recce_cloud/test_client.py +273 -0
- tests/recce_cloud/test_platform_clients.py +333 -0
- tests/tasks/conftest.py +1 -1
- tests/tasks/test_histogram.py +58 -66
- tests/tasks/test_lineage.py +36 -23
- tests/tasks/test_preset_checks.py +45 -31
- tests/tasks/test_profile.py +339 -15
- tests/tasks/test_query.py +46 -46
- tests/tasks/test_row_count.py +65 -46
- tests/tasks/test_schema.py +65 -42
- tests/tasks/test_top_k.py +22 -18
- tests/tasks/test_valuediff.py +43 -32
- tests/test_cli.py +174 -60
- tests/test_cli_mcp_optional.py +45 -0
- tests/test_cloud_listing_cli.py +324 -0
- tests/test_config.py +7 -9
- tests/test_connect_to_cloud.py +82 -0
- tests/test_core.py +151 -4
- tests/test_dbt.py +7 -7
- tests/test_mcp_server.py +332 -0
- tests/test_pull_request.py +1 -1
- tests/test_server.py +25 -19
- tests/test_summary.py +29 -17
- recce/data/_next/static/Kcbs3GEIyH2LxgLYat0es/_buildManifest.js +0 -1
- recce/data/_next/static/chunks/1f229bf6-d9fe92e56db8d93b.js +0 -1
- recce/data/_next/static/chunks/29e3cc0d-8c150e37dff9631b.js +0 -1
- recce/data/_next/static/chunks/368-7587b306577df275.js +0 -65
- recce/data/_next/static/chunks/36e1c10d-bb0210cbd6573a8d.js +0 -1
- recce/data/_next/static/chunks/3998a672-eaad84bdd88cc73e.js +0 -1
- recce/data/_next/static/chunks/3a92ee20-3b5d922d4157af5e.js +0 -1
- recce/data/_next/static/chunks/450c323b-1bb5db526e54435a.js +0 -1
- recce/data/_next/static/chunks/47d8844f-79a1b53c66a7d7ec.js +0 -1
- recce/data/_next/static/chunks/6dc81886-c94b9b91bc2c3caf.js +0 -1
- recce/data/_next/static/chunks/6ef81909-694dc38134099299.js +0 -1
- recce/data/_next/static/chunks/700-3b65fc3666820d00.js +0 -2
- recce/data/_next/static/chunks/7a8a3e83-d7fa409d97b38b2b.js +0 -1
- recce/data/_next/static/chunks/7f27ae6c-413f6b869a04183a.js +0 -1
- recce/data/_next/static/chunks/8d700b6a-f0b1f6b9e0d97ce2.js +0 -1
- recce/data/_next/static/chunks/9746af58-d74bef4d03eea6ab.js +0 -1
- recce/data/_next/static/chunks/a30376cd-7d806e1602f2dc3a.js +0 -1
- recce/data/_next/static/chunks/app/_not-found/page-8a886fa0855c3105.js +0 -1
- recce/data/_next/static/chunks/app/layout-9102e22cb73f74d6.js +0 -1
- recce/data/_next/static/chunks/app/page-cee661090afbd6aa.js +0 -1
- recce/data/_next/static/chunks/b63b1b3f-7395c74e11a14e95.js +0 -1
- recce/data/_next/static/chunks/c132bf7d-8102037f9ccf372a.js +0 -1
- recce/data/_next/static/chunks/c1ceaa8b-a1e442154d23515e.js +0 -1
- recce/data/_next/static/chunks/cd9f8d63-cf0d5a7b0f7a92e8.js +0 -54
- recce/data/_next/static/chunks/ce84277d-f42c2c58049cea2d.js +0 -1
- recce/data/_next/static/chunks/e24bf851-0f8cbc99656833e7.js +0 -1
- recce/data/_next/static/chunks/fee69bc6-f17d36c080742e74.js +0 -1
- recce/data/_next/static/chunks/framework-ded83d71b51ce901.js +0 -1
- recce/data/_next/static/chunks/main-a0859f1f36d0aa6c.js +0 -1
- recce/data/_next/static/chunks/main-app-0225a2255968e566.js +0 -1
- recce/data/_next/static/chunks/pages/_app-d5672bf3d8b6371b.js +0 -1
- recce/data/_next/static/chunks/pages/_error-ed75be3f25588548.js +0 -1
- recce/data/_next/static/chunks/webpack-567d72f0bc0820d5.js +0 -1
- recce/data/_next/static/css/c9ecb46a4b21c126.css +0 -14
- recce/data/_next/static/media/montserrat-cyrillic-800-normal.22628180.woff2 +0 -0
- recce/data/_next/static/media/montserrat-cyrillic-800-normal.31d693bb.woff +0 -0
- recce/data/_next/static/media/montserrat-cyrillic-ext-800-normal.7e2c1e62.woff +0 -0
- recce/data/_next/static/media/montserrat-cyrillic-ext-800-normal.94a63aea.woff2 +0 -0
- recce/data/_next/static/media/montserrat-latin-800-normal.6f8fa298.woff2 +0 -0
- recce/data/_next/static/media/montserrat-latin-800-normal.97e20d5e.woff +0 -0
- recce/data/_next/static/media/montserrat-latin-ext-800-normal.013b84f9.woff2 +0 -0
- recce/data/_next/static/media/montserrat-latin-ext-800-normal.aff52ab0.woff +0 -0
- recce/data/_next/static/media/montserrat-vietnamese-800-normal.5f21869b.woff +0 -0
- recce/data/_next/static/media/montserrat-vietnamese-800-normal.c0035377.woff2 +0 -0
- recce/state.py +0 -753
- recce_nightly-1.2.0.20250506.dist-info/RECORD +0 -142
- tests/test_state.py +0 -123
- /recce/data/_next/static/{Kcbs3GEIyH2LxgLYat0es → 52aV_JrNUZU6dMFgvTQEO}/_ssgManifest.js +0 -0
- /recce/data/_next/static/chunks/{polyfills-42372ed130431b0a.js → a6dad97d9634a72d.js} +0 -0
- {recce_nightly-1.2.0.20250506.dist-info → recce_nightly-1.26.0.20251124.dist-info}/entry_points.txt +0 -0
- {recce_nightly-1.2.0.20250506.dist-info → recce_nightly-1.26.0.20251124.dist-info}/licenses/LICENSE +0 -0
tests/tasks/test_row_count.py
CHANGED
|
@@ -17,21 +17,21 @@ def test_row_count(dbt_test_helper):
|
|
|
17
17
|
2,Bob,25
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
|
-
dbt_test_helper.create_model("customers", csv_data_base, csv_data_curr, unique_id=
|
|
21
|
-
task = RowCountDiffTask(dict(node_names=[
|
|
20
|
+
dbt_test_helper.create_model("customers", csv_data_base, csv_data_curr, unique_id="model.customers")
|
|
21
|
+
task = RowCountDiffTask(dict(node_names=["customers"]))
|
|
22
22
|
run_result = task.execute()
|
|
23
|
-
assert run_result[
|
|
24
|
-
assert run_result[
|
|
23
|
+
assert run_result["customers"]["base"] == 2
|
|
24
|
+
assert run_result["customers"]["curr"] == 3
|
|
25
25
|
|
|
26
|
-
task = RowCountDiffTask(dict(node_names=[
|
|
26
|
+
task = RowCountDiffTask(dict(node_names=["customers_"]))
|
|
27
27
|
run_result = task.execute()
|
|
28
|
-
assert run_result[
|
|
29
|
-
assert run_result[
|
|
28
|
+
assert run_result["customers_"]["base"] is None
|
|
29
|
+
assert run_result["customers_"]["curr"] is None
|
|
30
30
|
|
|
31
|
-
task = RowCountDiffTask(dict(node_ids=[
|
|
31
|
+
task = RowCountDiffTask(dict(node_ids=["model.customers"]))
|
|
32
32
|
run_result = task.execute()
|
|
33
|
-
assert run_result[
|
|
34
|
-
assert run_result[
|
|
33
|
+
assert run_result["customers"]["base"] == 2
|
|
34
|
+
assert run_result["customers"]["curr"] == 3
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
def test_row_count_with_selector(dbt_test_helper):
|
|
@@ -49,13 +49,14 @@ def test_row_count_with_selector(dbt_test_helper):
|
|
|
49
49
|
"""
|
|
50
50
|
|
|
51
51
|
dbt_test_helper.create_model("model_1", csv_data_1, csv_data_2, depends_on=[])
|
|
52
|
-
dbt_test_helper.create_model(
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
dbt_test_helper.create_model(
|
|
53
|
+
"model_2", csv_data_1, csv_data_1, depends_on=["model_1"], package_name="other_package"
|
|
54
|
+
)
|
|
55
|
+
task = RowCountDiffTask(dict(select="model_1"))
|
|
55
56
|
run_result = task.execute()
|
|
56
57
|
assert len(run_result) == 1
|
|
57
58
|
|
|
58
|
-
task = RowCountDiffTask(dict(select=
|
|
59
|
+
task = RowCountDiffTask(dict(select="model_1+"))
|
|
59
60
|
run_result = task.execute()
|
|
60
61
|
assert len(run_result) == 2
|
|
61
62
|
|
|
@@ -66,51 +67,69 @@ def test_validator():
|
|
|
66
67
|
validator = RowCountDiffCheckValidator()
|
|
67
68
|
|
|
68
69
|
def validate(params: dict):
|
|
69
|
-
validator.validate(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
validator.validate(
|
|
71
|
+
{
|
|
72
|
+
"name": "test",
|
|
73
|
+
"type": "row_count_diff",
|
|
74
|
+
"params": params,
|
|
75
|
+
}
|
|
76
|
+
)
|
|
74
77
|
|
|
75
78
|
# Select all modesl
|
|
76
79
|
validate({})
|
|
77
80
|
|
|
78
81
|
# Select by node name
|
|
79
|
-
validate(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
validate(
|
|
83
|
+
{
|
|
84
|
+
"node_names": ["abc"],
|
|
85
|
+
}
|
|
86
|
+
)
|
|
82
87
|
with pytest.raises(ValueError):
|
|
83
|
-
validate(
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
validate(
|
|
89
|
+
{
|
|
90
|
+
"node_names": "abc",
|
|
91
|
+
}
|
|
92
|
+
)
|
|
86
93
|
|
|
87
94
|
# Select by node id
|
|
88
|
-
validate(
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
validate(
|
|
96
|
+
{
|
|
97
|
+
"node_ids": ["model.abc"],
|
|
98
|
+
}
|
|
99
|
+
)
|
|
91
100
|
|
|
92
101
|
# Select by selector
|
|
93
|
-
validate(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
validate(
|
|
103
|
+
{
|
|
104
|
+
"select": "customers",
|
|
105
|
+
"exclude": "customers",
|
|
106
|
+
"packages": ["jaffle_shop"],
|
|
107
|
+
"view_mode": "all",
|
|
108
|
+
}
|
|
109
|
+
)
|
|
99
110
|
|
|
100
111
|
# packages should be an array
|
|
101
112
|
with pytest.raises(ValueError):
|
|
102
|
-
validate(
|
|
103
|
-
|
|
104
|
-
|
|
113
|
+
validate(
|
|
114
|
+
{
|
|
115
|
+
"packages": "jaffle_shop",
|
|
116
|
+
}
|
|
117
|
+
)
|
|
105
118
|
|
|
106
119
|
# view_mode should be 'all' or 'changed_models'
|
|
107
|
-
validate(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
120
|
+
validate(
|
|
121
|
+
{
|
|
122
|
+
"view_mode": None,
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
validate(
|
|
126
|
+
{
|
|
127
|
+
"view_mode": "all",
|
|
128
|
+
}
|
|
129
|
+
)
|
|
113
130
|
with pytest.raises(ValueError):
|
|
114
|
-
validate(
|
|
115
|
-
|
|
116
|
-
|
|
131
|
+
validate(
|
|
132
|
+
{
|
|
133
|
+
"view_mode": "abc",
|
|
134
|
+
}
|
|
135
|
+
)
|
tests/tasks/test_schema.py
CHANGED
|
@@ -4,58 +4,75 @@ from unittest.mock import MagicMock
|
|
|
4
4
|
|
|
5
5
|
import pytest
|
|
6
6
|
|
|
7
|
-
from recce.adapter.dbt_adapter import
|
|
7
|
+
from recce.adapter.dbt_adapter import DbtAdapter, load_catalog, load_manifest
|
|
8
8
|
from recce.core import RecceContext, set_default_context
|
|
9
9
|
from recce.run import schema_diff_should_be_approved
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def test_validator():
|
|
13
13
|
from recce.tasks.schema import SchemaDiffCheckValidator
|
|
14
|
+
|
|
14
15
|
validator = SchemaDiffCheckValidator()
|
|
15
16
|
|
|
16
17
|
def validate(params: dict):
|
|
17
|
-
validator.validate(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
validator.validate(
|
|
19
|
+
{
|
|
20
|
+
"name": "test",
|
|
21
|
+
"type": "schema_diff",
|
|
22
|
+
"params": params,
|
|
23
|
+
}
|
|
24
|
+
)
|
|
22
25
|
|
|
23
26
|
# Select all models
|
|
24
27
|
validate({})
|
|
25
28
|
|
|
26
29
|
# Select by node name
|
|
27
|
-
validate(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
validate(
|
|
31
|
+
{
|
|
32
|
+
"node_id": "abc",
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
validate(
|
|
36
|
+
{
|
|
37
|
+
"node_id": ["abc"],
|
|
38
|
+
}
|
|
39
|
+
)
|
|
33
40
|
|
|
34
41
|
# Select by selector
|
|
35
|
-
validate(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
validate(
|
|
43
|
+
{
|
|
44
|
+
"select": "customers",
|
|
45
|
+
"exclude": "customers",
|
|
46
|
+
"packages": ["jaffle_shop"],
|
|
47
|
+
"view_mode": "all",
|
|
48
|
+
}
|
|
49
|
+
)
|
|
41
50
|
|
|
42
51
|
# packages should be an array
|
|
43
52
|
with pytest.raises(ValueError):
|
|
44
|
-
validate(
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
validate(
|
|
54
|
+
{
|
|
55
|
+
"packages": "jaffle_shop",
|
|
56
|
+
}
|
|
57
|
+
)
|
|
47
58
|
|
|
48
59
|
# view_mode should be 'all' or 'changed_models'
|
|
49
|
-
validate(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
60
|
+
validate(
|
|
61
|
+
{
|
|
62
|
+
"view_mode": None,
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
validate(
|
|
66
|
+
{
|
|
67
|
+
"view_mode": "all",
|
|
68
|
+
}
|
|
69
|
+
)
|
|
55
70
|
with pytest.raises(ValueError):
|
|
56
|
-
validate(
|
|
57
|
-
|
|
58
|
-
|
|
71
|
+
validate(
|
|
72
|
+
{
|
|
73
|
+
"view_mode": "abc",
|
|
74
|
+
}
|
|
75
|
+
)
|
|
59
76
|
|
|
60
77
|
|
|
61
78
|
test_root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
@@ -65,8 +82,8 @@ class TestSchemaDiffAutoApprove(TestCase):
|
|
|
65
82
|
|
|
66
83
|
def setUp(self):
|
|
67
84
|
self.default_context = MagicMock(spec=RecceContext)
|
|
68
|
-
manifest = load_manifest(path=os.path.join(test_root_path,
|
|
69
|
-
catalog = load_catalog(path=os.path.join(test_root_path,
|
|
85
|
+
manifest = load_manifest(path=os.path.join(test_root_path, "manifest.json"))
|
|
86
|
+
catalog = load_catalog(path=os.path.join(test_root_path, "catalog.json"))
|
|
70
87
|
dbt_adapter = DbtAdapter(curr_manifest=manifest, curr_catalog=catalog)
|
|
71
88
|
self.default_context.adapter = dbt_adapter
|
|
72
89
|
|
|
@@ -80,20 +97,26 @@ class TestSchemaDiffAutoApprove(TestCase):
|
|
|
80
97
|
|
|
81
98
|
def test_schema_diff_should_be_approved(self):
|
|
82
99
|
# Node_id is string
|
|
83
|
-
is_approved = schema_diff_should_be_approved(
|
|
84
|
-
|
|
85
|
-
|
|
100
|
+
is_approved = schema_diff_should_be_approved(
|
|
101
|
+
{
|
|
102
|
+
"node_id": "model.jaffle_shop.customers",
|
|
103
|
+
}
|
|
104
|
+
)
|
|
86
105
|
assert is_approved is True
|
|
87
106
|
|
|
88
107
|
# Node_id is list
|
|
89
|
-
is_approved = schema_diff_should_be_approved(
|
|
90
|
-
|
|
91
|
-
|
|
108
|
+
is_approved = schema_diff_should_be_approved(
|
|
109
|
+
{
|
|
110
|
+
"node_id": ["model.jaffle_shop.customers"],
|
|
111
|
+
}
|
|
112
|
+
)
|
|
92
113
|
assert is_approved is True
|
|
93
114
|
|
|
94
115
|
# Select all models
|
|
95
|
-
self.default_context.adapter.select_nodes.return_value = [
|
|
96
|
-
is_approved = schema_diff_should_be_approved(
|
|
97
|
-
|
|
98
|
-
|
|
116
|
+
self.default_context.adapter.select_nodes.return_value = ["model.jaffle_shop.customers"]
|
|
117
|
+
is_approved = schema_diff_should_be_approved(
|
|
118
|
+
{
|
|
119
|
+
"select": "customers",
|
|
120
|
+
}
|
|
121
|
+
)
|
|
99
122
|
assert is_approved is True
|
tests/tasks/test_top_k.py
CHANGED
|
@@ -38,10 +38,10 @@ def test_top_k(dbt_test_helper):
|
|
|
38
38
|
# 'valids': 4,
|
|
39
39
|
# 'total': 4
|
|
40
40
|
# }
|
|
41
|
-
assert run_result[
|
|
42
|
-
assert run_result[
|
|
43
|
-
assert run_result[
|
|
44
|
-
assert run_result[
|
|
41
|
+
assert run_result["current"]["values"][0] == "Bob"
|
|
42
|
+
assert run_result["current"]["counts"][0] == 2
|
|
43
|
+
assert run_result["current"]["valids"] == 4
|
|
44
|
+
assert run_result["current"]["total"] == 4
|
|
45
45
|
|
|
46
46
|
# {
|
|
47
47
|
# 'values': ['Bob', 'Alice', 'Charlie'],
|
|
@@ -49,25 +49,29 @@ def test_top_k(dbt_test_helper):
|
|
|
49
49
|
# 'valids': 3,
|
|
50
50
|
# 'total': 4
|
|
51
51
|
# }
|
|
52
|
-
assert run_result[
|
|
53
|
-
assert run_result[
|
|
54
|
-
assert run_result[
|
|
52
|
+
assert run_result["base"]["counts"][0] == 1
|
|
53
|
+
assert run_result["base"]["valids"] == 3
|
|
54
|
+
assert run_result["base"]["total"] == 4
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
def test_validator():
|
|
58
58
|
def validate(params: dict = {}, view_options: dict = {}):
|
|
59
|
-
TopKDiffCheckValidator().validate(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
TopKDiffCheckValidator().validate(
|
|
60
|
+
{
|
|
61
|
+
"name": "test",
|
|
62
|
+
"type": "top_k_diff",
|
|
63
|
+
"params": params,
|
|
64
|
+
"view_options": view_options,
|
|
65
|
+
}
|
|
66
|
+
)
|
|
65
67
|
|
|
66
|
-
validate(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
validate(
|
|
69
|
+
{
|
|
70
|
+
"model": "customers",
|
|
71
|
+
"column_name": "name",
|
|
72
|
+
"k": 50,
|
|
73
|
+
}
|
|
74
|
+
)
|
|
71
75
|
|
|
72
76
|
with pytest.raises(ValueError):
|
|
73
77
|
validate({})
|
tests/tasks/test_valuediff.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
|
|
3
|
-
from recce.tasks import
|
|
3
|
+
from recce.tasks import ValueDiffDetailTask, ValueDiffTask
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
def test_value_diff(dbt_test_helper):
|
|
@@ -19,13 +19,13 @@ def test_value_diff(dbt_test_helper):
|
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
21
|
dbt_test_helper.create_model("customers", csv_data_base, csv_data_curr)
|
|
22
|
-
params = dict(model=
|
|
22
|
+
params = dict(model="customers", primary_key=["customer_id"])
|
|
23
23
|
task = ValueDiffTask(params)
|
|
24
24
|
run_result = task.execute()
|
|
25
25
|
assert len(run_result.data.columns) == 3
|
|
26
26
|
assert len(run_result.data.data) == 3
|
|
27
27
|
|
|
28
|
-
params = dict(model=
|
|
28
|
+
params = dict(model="customers", primary_key=["customer_id"])
|
|
29
29
|
task = ValueDiffDetailTask(params)
|
|
30
30
|
run_result = task.execute()
|
|
31
31
|
assert len(run_result.columns) == 5
|
|
@@ -36,39 +36,50 @@ def test_validator():
|
|
|
36
36
|
from recce.tasks.valuediff import ValueDiffCheckValidator
|
|
37
37
|
|
|
38
38
|
def validate(params: dict = {}, view_options: dict = {}):
|
|
39
|
-
ValueDiffCheckValidator().validate(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
ValueDiffCheckValidator().validate(
|
|
40
|
+
{
|
|
41
|
+
"name": "test",
|
|
42
|
+
"type": "value_diff",
|
|
43
|
+
"params": params,
|
|
44
|
+
"view_options": view_options,
|
|
45
|
+
}
|
|
46
|
+
)
|
|
45
47
|
|
|
46
|
-
validate(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
validate(
|
|
49
|
+
{
|
|
50
|
+
"model": "customers",
|
|
51
|
+
"primary_key": "customer_id",
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
validate(
|
|
55
|
+
{
|
|
56
|
+
"model": "customers",
|
|
57
|
+
"primary_key": ["customer_id"],
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
validate(
|
|
61
|
+
{
|
|
62
|
+
"model": "customers",
|
|
63
|
+
"primary_key": ["customer_id"],
|
|
64
|
+
"columns": ["name", "age"],
|
|
65
|
+
}
|
|
66
|
+
)
|
|
59
67
|
|
|
60
68
|
with pytest.raises(ValueError):
|
|
61
|
-
validate({
|
|
62
|
-
})
|
|
69
|
+
validate({})
|
|
63
70
|
|
|
64
71
|
with pytest.raises(ValueError):
|
|
65
|
-
validate(
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
validate(
|
|
73
|
+
{
|
|
74
|
+
"model": "customers",
|
|
75
|
+
}
|
|
76
|
+
)
|
|
68
77
|
|
|
69
78
|
with pytest.raises(ValueError):
|
|
70
|
-
validate(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
79
|
+
validate(
|
|
80
|
+
{
|
|
81
|
+
"model": "customers",
|
|
82
|
+
"primary_key": ["customer_id"],
|
|
83
|
+
"columns": "name",
|
|
84
|
+
}
|
|
85
|
+
)
|