sqlassert-dbt 0.4.1__tar.gz → 0.4.2__tar.gz
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.
- {sqlassert_dbt-0.4.1/sqlassert_dbt.egg-info → sqlassert_dbt-0.4.2}/PKG-INFO +7 -9
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/README.md +5 -7
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/pyproject.toml +3 -3
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/sqlassert_dbt/__init__.py +1 -1
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/sqlassert_dbt/__main__.py +1 -1
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/sqlassert_dbt/connect.py +6 -8
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/sqlassert_dbt/expectations.py +2 -11
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/sqlassert_dbt/project.py +1 -1
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2/sqlassert_dbt.egg-info}/PKG-INFO +7 -9
- sqlassert_dbt-0.4.2/sqlassert_dbt.egg-info/scm_version.json +8 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/test_contracts.py +2 -14
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/test_dbt.py +2 -20
- sqlassert_dbt-0.4.1/sqlassert_dbt.egg-info/scm_version.json +0 -8
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/LICENSE +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/setup.cfg +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/sqlassert_dbt/jinja.py +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/sqlassert_dbt/manifest.py +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/sqlassert_dbt/program.py +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/sqlassert_dbt/report.py +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/sqlassert_dbt.egg-info/SOURCES.txt +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/sqlassert_dbt.egg-info/dependency_links.txt +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/sqlassert_dbt.egg-info/entry_points.txt +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/sqlassert_dbt.egg-info/requires.txt +1 -1
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/sqlassert_dbt.egg-info/scm_file_list.json +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/sqlassert_dbt.egg-info/top_level.txt +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/conftest.py +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/dbt_project/dbt_project.yml +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/dbt_project/models/active_customers.sql +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/dbt_project/models/customer_keys.sql +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/dbt_project/models/customer_orders.sql +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/dbt_project/models/customer_signups.sql +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/dbt_project/models/customers.sql +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/dbt_project/models/orders_appended.sql +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/dbt_project/models/orders_incremental.sql +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/dbt_project/models/schema.yml +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/dbt_project/models/stg_customers.sql +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/dbt_project/models/stg_orders.sql +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/dbt_project/profiles.yml +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/dbt_project/seeds/raw_payments.csv +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/dbt_runs.py +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/test_catalog.py +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/test_connect.py +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/test_file_sources.py +0 -0
- {sqlassert_dbt-0.4.1 → sqlassert_dbt-0.4.2}/tests/test_suggest.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlassert-dbt
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Check a dbt project's tests and sqlassert markers from its compiled manifest.
|
|
5
5
|
Author: Fred Israel
|
|
6
6
|
License-Expression: MIT
|
|
@@ -14,10 +14,10 @@ Classifier: Topic :: Software Development :: Quality Assurance
|
|
|
14
14
|
Requires-Python: >=3.13
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
|
+
Requires-Dist: dbt-core>=1.12
|
|
17
18
|
Requires-Dist: sqlassert>=0.3.1
|
|
18
19
|
Requires-Dist: sqlglot<31,>=30.30
|
|
19
20
|
Provides-Extra: test
|
|
20
|
-
Requires-Dist: dbt-core>=1.12; extra == "test"
|
|
21
21
|
Requires-Dist: dbt-duckdb>=1.11; extra == "test"
|
|
22
22
|
Requires-Dist: duckdb; extra == "test"
|
|
23
23
|
Requires-Dist: pytest; extra == "test"
|
|
@@ -64,10 +64,9 @@ A `profiles.yml` kept in the project directory is found without
|
|
|
64
64
|
`--profiles-dir` (by `build`, `test` and `suggest`), unless the working
|
|
65
65
|
directory has one or `DBT_PROFILES_DIR` is set.
|
|
66
66
|
|
|
67
|
-
## Check
|
|
67
|
+
## Check
|
|
68
68
|
|
|
69
|
-
`check` reads
|
|
70
|
-
where it runs (a CI step after `dbt compile`, say):
|
|
69
|
+
`check` reads `target/manifest.json`, so run it after `dbt compile`:
|
|
71
70
|
|
|
72
71
|
```bash
|
|
73
72
|
$ dbt compile
|
|
@@ -122,7 +121,7 @@ manifest cannot be read.
|
|
|
122
121
|
A model's own tests are what gets proved. Upstream tests are evidence, used
|
|
123
122
|
only when they fail on any failing row: not a test with `severity: warn`, a
|
|
124
123
|
`where:` config, or `error_if`/`fail_calc` thresholds. A constraint counts only
|
|
125
|
-
on a
|
|
124
|
+
on a table with an enforced contract, whether or not the adapter checks it.
|
|
126
125
|
|
|
127
126
|
## Suggest from the models you're editing
|
|
128
127
|
|
|
@@ -217,8 +216,7 @@ read then. An enforced contract's table is still declared from the contract,
|
|
|
217
216
|
since the build may not have made it yet; every other table comes from the
|
|
218
217
|
warehouse.
|
|
219
218
|
As with `analyze_database`, a connection only adds proofs. A key the
|
|
220
|
-
warehouse does not enforce is trusted
|
|
221
|
-
own are.
|
|
219
|
+
warehouse does not enforce is trusted, as the SQL's own are.
|
|
222
220
|
|
|
223
221
|
```bash
|
|
224
222
|
$ sqlassert-dbt build --connect .
|
|
@@ -238,7 +236,7 @@ report = analyze_project(project, fetcher=DuckDBKnowledgeFetcher(duckdb.connect(
|
|
|
238
236
|
```
|
|
239
237
|
|
|
240
238
|
`suggest_models(..., fetcher=...)` takes one too. `check` stays
|
|
241
|
-
connectionless
|
|
239
|
+
connectionless.
|
|
242
240
|
|
|
243
241
|
## Details
|
|
244
242
|
|
|
@@ -39,10 +39,9 @@ A `profiles.yml` kept in the project directory is found without
|
|
|
39
39
|
`--profiles-dir` (by `build`, `test` and `suggest`), unless the working
|
|
40
40
|
directory has one or `DBT_PROFILES_DIR` is set.
|
|
41
41
|
|
|
42
|
-
## Check
|
|
42
|
+
## Check
|
|
43
43
|
|
|
44
|
-
`check` reads
|
|
45
|
-
where it runs (a CI step after `dbt compile`, say):
|
|
44
|
+
`check` reads `target/manifest.json`, so run it after `dbt compile`:
|
|
46
45
|
|
|
47
46
|
```bash
|
|
48
47
|
$ dbt compile
|
|
@@ -97,7 +96,7 @@ manifest cannot be read.
|
|
|
97
96
|
A model's own tests are what gets proved. Upstream tests are evidence, used
|
|
98
97
|
only when they fail on any failing row: not a test with `severity: warn`, a
|
|
99
98
|
`where:` config, or `error_if`/`fail_calc` thresholds. A constraint counts only
|
|
100
|
-
on a
|
|
99
|
+
on a table with an enforced contract, whether or not the adapter checks it.
|
|
101
100
|
|
|
102
101
|
## Suggest from the models you're editing
|
|
103
102
|
|
|
@@ -192,8 +191,7 @@ read then. An enforced contract's table is still declared from the contract,
|
|
|
192
191
|
since the build may not have made it yet; every other table comes from the
|
|
193
192
|
warehouse.
|
|
194
193
|
As with `analyze_database`, a connection only adds proofs. A key the
|
|
195
|
-
warehouse does not enforce is trusted
|
|
196
|
-
own are.
|
|
194
|
+
warehouse does not enforce is trusted, as the SQL's own are.
|
|
197
195
|
|
|
198
196
|
```bash
|
|
199
197
|
$ sqlassert-dbt build --connect .
|
|
@@ -213,7 +211,7 @@ report = analyze_project(project, fetcher=DuckDBKnowledgeFetcher(duckdb.connect(
|
|
|
213
211
|
```
|
|
214
212
|
|
|
215
213
|
`suggest_models(..., fetcher=...)` takes one too. `check` stays
|
|
216
|
-
connectionless
|
|
214
|
+
connectionless.
|
|
217
215
|
|
|
218
216
|
## Details
|
|
219
217
|
|
|
@@ -18,9 +18,10 @@ classifiers = [
|
|
|
18
18
|
"Topic :: Database",
|
|
19
19
|
"Topic :: Software Development :: Quality Assurance",
|
|
20
20
|
]
|
|
21
|
-
#
|
|
22
|
-
#
|
|
21
|
+
# The plugin may use dbt itself (compiling, connecting); the sqlassert
|
|
22
|
+
# package never does.
|
|
23
23
|
dependencies = [
|
|
24
|
+
"dbt-core>=1.12",
|
|
24
25
|
"sqlassert>=0.3.1",
|
|
25
26
|
"sqlglot>=30.30,<31",
|
|
26
27
|
]
|
|
@@ -34,7 +35,6 @@ sqlassert-dbt = "sqlassert_dbt.__main__:main"
|
|
|
34
35
|
|
|
35
36
|
[project.optional-dependencies]
|
|
36
37
|
test = [
|
|
37
|
-
"dbt-core>=1.12",
|
|
38
38
|
"dbt-duckdb>=1.11",
|
|
39
39
|
"duckdb",
|
|
40
40
|
"pytest",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""dbt integration: check a dbt project's tests and Property Markers from its manifest
|
|
1
|
+
"""dbt integration: check a dbt project's tests and Property Markers from its manifest.
|
|
2
2
|
|
|
3
3
|
`analyze_project(project_dir)` reads `target/manifest.json` and returns a
|
|
4
4
|
`DbtReport`: which tests the SQL proves (skippable), which it does not, which
|
|
@@ -59,7 +59,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
59
59
|
commands = parser.add_subparsers(dest="command", required=True)
|
|
60
60
|
check = commands.add_parser(
|
|
61
61
|
"check",
|
|
62
|
-
help="check the tests and markers of a compiled project
|
|
62
|
+
help="check the tests and markers of a compiled project",
|
|
63
63
|
description="Check a dbt project's tests and markers from its target/manifest.json (run `dbt compile` first). "
|
|
64
64
|
f"Exit status: {EXIT_OK} every marker PROVED, {EXIT_FINDINGS} a marker UNKNOWN or a diagnostic reported, "
|
|
65
65
|
f"{EXIT_USAGE} the manifest cannot be read.",
|
|
@@ -61,14 +61,12 @@ def dbt_fetcher(project: Path, dbt_arguments: list[str]) -> Generator[DatabaseKn
|
|
|
61
61
|
"""A fetcher over the connection dbt opens for `project` with the
|
|
62
62
|
profile, target, profiles directory and vars in `dbt_arguments`, closed
|
|
63
63
|
on exit: a DuckDB file takes one writer, so close it before dbt runs again."""
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
except ImportError as error:
|
|
71
|
-
raise ConnectError(f"--connect needs dbt installed in sqlassert-dbt's Python ({error})") from error
|
|
64
|
+
import yaml
|
|
65
|
+
from dbt.adapters.factory import cleanup_connections, get_adapter, register_adapter, reset_adapters
|
|
66
|
+
from dbt.config.runtime import RuntimeConfig
|
|
67
|
+
from dbt.flags import set_from_args
|
|
68
|
+
from dbt.mp_context import get_mp_context
|
|
69
|
+
|
|
72
70
|
try:
|
|
73
71
|
args = Namespace(
|
|
74
72
|
project_dir=str(project), profiles_dir=str(_profiles_dir(project, dbt_arguments)),
|
|
@@ -30,14 +30,8 @@ from sqlassert.sql_parse import literal_value
|
|
|
30
30
|
# Referential Coverage (a dbt relationships test checks no Unique Set on its target).
|
|
31
31
|
type PropertyKind = Literal["unique", "key", "not_null", "enum", "coverage"]
|
|
32
32
|
|
|
33
|
-
#
|
|
34
|
-
# (
|
|
35
|
-
# NOT NULL only; their keys are informational. Constraints never apply to views.
|
|
36
|
-
_ENFORCED_CONSTRAINTS = {
|
|
37
|
-
"postgres": frozenset({"not_null", "unique", "primary_key", "foreign_key"}),
|
|
38
|
-
"duckdb": frozenset({"not_null", "unique", "primary_key", "foreign_key"}),
|
|
39
|
-
}
|
|
40
|
-
_NOT_NULL_ONLY = frozenset({"not_null"})
|
|
33
|
+
# Constraints a contracted table declares, whether or not the adapter enforces
|
|
34
|
+
# them (ADR 0012); they never apply to views.
|
|
41
35
|
_CONSTRAINED_MATERIALIZATIONS = {"table", "incremental"}
|
|
42
36
|
|
|
43
37
|
_IDENTIFIER = re.compile(r"[A-Za-z_][A-Za-z0-9_$]*")
|
|
@@ -315,7 +309,6 @@ def resolve(
|
|
|
315
309
|
|
|
316
310
|
|
|
317
311
|
def _constraints(relation: Relation, manifest: Manifest) -> Iterator[Expectation]:
|
|
318
|
-
enforced = _ENFORCED_CONSTRAINTS.get(manifest.adapter_type or "", _NOT_NULL_ONLY)
|
|
319
312
|
for index, constraint in enumerate(relation.constraints):
|
|
320
313
|
kind: PropertyKind
|
|
321
314
|
match constraint.type:
|
|
@@ -333,8 +326,6 @@ def _constraints(relation: Relation, manifest: Manifest) -> Iterator[Expectation
|
|
|
333
326
|
not_a_fact = "the model's contract is not enforced"
|
|
334
327
|
elif relation.materialized not in _CONSTRAINED_MATERIALIZATIONS:
|
|
335
328
|
not_a_fact = f"constraints are not applied to a {relation.materialized} materialization"
|
|
336
|
-
elif constraint.type not in enforced:
|
|
337
|
-
not_a_fact = f"{manifest.adapter_type} does not enforce {constraint.type} constraints"
|
|
338
329
|
else:
|
|
339
330
|
not_a_fact = None
|
|
340
331
|
base = Expectation(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Analyze a dbt project from its `target/manifest.json
|
|
1
|
+
"""Analyze a dbt project from its `target/manifest.json`.
|
|
2
2
|
|
|
3
3
|
The project is one Program (`program.py`), built once per run: each model's
|
|
4
4
|
tests are Assertions, the passing tests of what it reads are Property
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlassert-dbt
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Check a dbt project's tests and sqlassert markers from its compiled manifest.
|
|
5
5
|
Author: Fred Israel
|
|
6
6
|
License-Expression: MIT
|
|
@@ -14,10 +14,10 @@ Classifier: Topic :: Software Development :: Quality Assurance
|
|
|
14
14
|
Requires-Python: >=3.13
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
|
+
Requires-Dist: dbt-core>=1.12
|
|
17
18
|
Requires-Dist: sqlassert>=0.3.1
|
|
18
19
|
Requires-Dist: sqlglot<31,>=30.30
|
|
19
20
|
Provides-Extra: test
|
|
20
|
-
Requires-Dist: dbt-core>=1.12; extra == "test"
|
|
21
21
|
Requires-Dist: dbt-duckdb>=1.11; extra == "test"
|
|
22
22
|
Requires-Dist: duckdb; extra == "test"
|
|
23
23
|
Requires-Dist: pytest; extra == "test"
|
|
@@ -64,10 +64,9 @@ A `profiles.yml` kept in the project directory is found without
|
|
|
64
64
|
`--profiles-dir` (by `build`, `test` and `suggest`), unless the working
|
|
65
65
|
directory has one or `DBT_PROFILES_DIR` is set.
|
|
66
66
|
|
|
67
|
-
## Check
|
|
67
|
+
## Check
|
|
68
68
|
|
|
69
|
-
`check` reads
|
|
70
|
-
where it runs (a CI step after `dbt compile`, say):
|
|
69
|
+
`check` reads `target/manifest.json`, so run it after `dbt compile`:
|
|
71
70
|
|
|
72
71
|
```bash
|
|
73
72
|
$ dbt compile
|
|
@@ -122,7 +121,7 @@ manifest cannot be read.
|
|
|
122
121
|
A model's own tests are what gets proved. Upstream tests are evidence, used
|
|
123
122
|
only when they fail on any failing row: not a test with `severity: warn`, a
|
|
124
123
|
`where:` config, or `error_if`/`fail_calc` thresholds. A constraint counts only
|
|
125
|
-
on a
|
|
124
|
+
on a table with an enforced contract, whether or not the adapter checks it.
|
|
126
125
|
|
|
127
126
|
## Suggest from the models you're editing
|
|
128
127
|
|
|
@@ -217,8 +216,7 @@ read then. An enforced contract's table is still declared from the contract,
|
|
|
217
216
|
since the build may not have made it yet; every other table comes from the
|
|
218
217
|
warehouse.
|
|
219
218
|
As with `analyze_database`, a connection only adds proofs. A key the
|
|
220
|
-
warehouse does not enforce is trusted
|
|
221
|
-
own are.
|
|
219
|
+
warehouse does not enforce is trusted, as the SQL's own are.
|
|
222
220
|
|
|
223
221
|
```bash
|
|
224
222
|
$ sqlassert-dbt build --connect .
|
|
@@ -238,7 +236,7 @@ report = analyze_project(project, fetcher=DuckDBKnowledgeFetcher(duckdb.connect(
|
|
|
238
236
|
```
|
|
239
237
|
|
|
240
238
|
`suggest_models(..., fetcher=...)` takes one too. `check` stays
|
|
241
|
-
connectionless
|
|
239
|
+
connectionless.
|
|
242
240
|
|
|
243
241
|
## Details
|
|
244
242
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Model contract constraints against dbt itself: the manifest shape `dbt
|
|
2
|
-
compile` writes for them,
|
|
3
|
-
|
|
2
|
+
compile` writes for them, and that the warehouse (DuckDB) builds a contracted
|
|
3
|
+
table only when its data satisfies the constraint."""
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
@@ -8,12 +8,8 @@ from pathlib import Path
|
|
|
8
8
|
|
|
9
9
|
import pytest
|
|
10
10
|
from dbt_runs import copy_source, dbt
|
|
11
|
-
from dbt.adapters.base.impl import ConstraintSupport
|
|
12
|
-
from dbt.adapters.duckdb.impl import DuckDBAdapter
|
|
13
|
-
from dbt_common.contracts.constraints import ConstraintType
|
|
14
11
|
|
|
15
12
|
from sqlassert_dbt import Status, analyze_project
|
|
16
|
-
from sqlassert_dbt.expectations import _ENFORCED_CONSTRAINTS
|
|
17
13
|
|
|
18
14
|
|
|
19
15
|
def statuses(project: Path) -> dict[str, Status]:
|
|
@@ -38,14 +34,6 @@ def test_without_an_enforced_contract_the_constraints_are_no_facts(tmp_path):
|
|
|
38
34
|
assert found["unique_customer_signups_signup_code"] is Status.NOT_PROVED
|
|
39
35
|
|
|
40
36
|
|
|
41
|
-
def test_the_duckdb_constraint_table_is_dbt_duckdbs():
|
|
42
|
-
enforced = {
|
|
43
|
-
kind.value for kind, support in DuckDBAdapter.CONSTRAINT_SUPPORT.items()
|
|
44
|
-
if support is ConstraintSupport.ENFORCED and kind is not ConstraintType.check # a check states no Property
|
|
45
|
-
}
|
|
46
|
-
assert _ENFORCED_CONSTRAINTS["duckdb"] == enforced
|
|
47
|
-
|
|
48
|
-
|
|
49
37
|
@pytest.mark.parametrize(("rows", "builds"), [("(1, 'a'), (2, 'b')", True), ("(1, 'a'), (1, 'b')", False)])
|
|
50
38
|
def test_duckdb_enforces_a_contracted_primary_key(tmp_path, rows, builds):
|
|
51
39
|
project = copy_source(tmp_path)
|
|
@@ -3,7 +3,6 @@ in conftest.py); a test that needs another manifest edits a copy of it."""
|
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
|
-
import ast
|
|
7
6
|
import json
|
|
8
7
|
import shutil
|
|
9
8
|
from collections.abc import Callable
|
|
@@ -540,9 +539,9 @@ def test_a_test_of_an_expression_states_no_property(copy_project):
|
|
|
540
539
|
("duckdb", "table", True, True),
|
|
541
540
|
("duckdb", "view", True, False),
|
|
542
541
|
("duckdb", "table", False, False),
|
|
543
|
-
("snowflake", "table", True,
|
|
542
|
+
("snowflake", "table", True, True),
|
|
544
543
|
])
|
|
545
|
-
def
|
|
544
|
+
def test_a_primary_key_constraint_is_a_fact_only_on_a_contracted_table(copy_project, adapter, materialized, enforced, fact):
|
|
546
545
|
project = copy_project()
|
|
547
546
|
|
|
548
547
|
def edit(manifest):
|
|
@@ -623,23 +622,6 @@ def test_render_refuses_anything_outside_its_subset(raw):
|
|
|
623
622
|
render(raw, incremental=False, resolve=resolve)
|
|
624
623
|
|
|
625
624
|
|
|
626
|
-
# Packaging
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
def test_the_plugin_reads_the_manifest_without_importing_dbt():
|
|
630
|
-
# dbt compiles the project; checking it needs only the manifest, so dbt is a test dependency.
|
|
631
|
-
# Only `--connect` imports dbt, inside the function that opens its connection.
|
|
632
|
-
for path in (Path(__file__).parents[1] / "sqlassert_dbt").rglob("*.py"):
|
|
633
|
-
for node in ast.parse(path.read_text()).body:
|
|
634
|
-
if isinstance(node, ast.Import):
|
|
635
|
-
names = [alias.name for alias in node.names]
|
|
636
|
-
elif isinstance(node, ast.ImportFrom):
|
|
637
|
-
names = [node.module or ""]
|
|
638
|
-
else:
|
|
639
|
-
continue
|
|
640
|
-
assert not any(name.split(".")[0] in {"dbt", "dbt_common"} for name in names), path
|
|
641
|
-
|
|
642
|
-
|
|
643
625
|
def test_an_incremental_batch_reads_its_own_previous_rows_without_its_tests(tmp_path):
|
|
644
626
|
# The incremental branch reads {{ this }}: the rows before this run, which
|
|
645
627
|
# its own tests (checked after the run) say nothing about. Were they facts
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|