Skip to content

Commit 68b9f10

Browse files
authored
Merge pull request #316 from godatadriven/support-artifacts-0.8
Support dbt-artifacts-parser>=0.8
2 parents 03f81ad + 9e117a8 commit 68b9f10

File tree

10 files changed

+284
-278
lines changed

10 files changed

+284
-278
lines changed

poetry.lock

+237-237
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ version = "0.0.0"
8383
[tool.poetry.dependencies]
8484
python = ">=3.9,<3.14"
8585
click = "<9"
86-
dbt-artifacts-parser = "<0.8"
86+
dbt-artifacts-parser = ">=0.8"
8787
jinja2 = "^3"
8888
jinja2-simple-tags = "^0"
8989
levenshtein = ">=0.26.1"
@@ -165,7 +165,7 @@ indent-width = 4
165165
target-version = "py38"
166166

167167
[tool.ruff.lint]
168-
ignore = ["COM812", "D100", "D203", "D213", "D406", "D407", "D409", "E501", "G004", "S101"]
168+
ignore = ["COM812", "D100", "D203", "D213", "D406", "D407", "D409", "E501", "G004", "LOG015", "S101"]
169169
preview=true
170170
select = ["A", "ARG", "B", "C4", "COM", "D", "DOC", "E", "EXE", "F", "I", "ICN", "LOG", "G", "N", "PT", "PTH", "Q", "RUF", "S", "SIM", "T20", "TCH", "TID", "W"]
171171
unfixable = ["B"]

scripts/generate_artifacts.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
def build_pex_file(dbt_version, pex_file_name):
1010
"""Build a pex file of `dbt-bouncer` if it does not already exist."""
1111
if not Path(pex_file_name).exists():
12-
logging.info(f"Building pex file for dbt version {dbt_version}") # noqa: LOG015
12+
logging.info(f"Building pex file for dbt version {dbt_version}")
1313
sh.poetry(
1414
[
1515
"run",
@@ -42,7 +42,7 @@ def generate_artifacts(
4242
pex_file_name,
4343
):
4444
"""Generate dbt artifacts for all specified versions of dbt. These artifacts are used in testing."""
45-
logging.info(f"Generating dbt artifacts for dbt version {dbt_version}") # noqa: LOG015
45+
logging.info(f"Generating dbt artifacts for dbt version {dbt_version}")
4646
Path(artifact_path).mkdir(exist_ok=True, parents=True)
4747
sh.python(
4848
[

src/dbt_bouncer/artifact_parsers/parsers_catalog.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
with warnings.catch_warnings():
1010
warnings.filterwarnings("ignore", category=UserWarning)
1111
from dbt_artifacts_parser.parsers.catalog.catalog_v1 import (
12-
CatalogTable,
1312
CatalogV1,
1413
)
14+
from dbt_artifacts_parser.parsers.catalog.catalog_v1 import (
15+
Nodes as CatalogNodes,
16+
)
1517
if TYPE_CHECKING:
1618
from pathlib import Path
1719

@@ -24,7 +26,7 @@
2426
class DbtBouncerCatalogNode(BaseModel):
2527
"""Model for all nodes in `catalog.json`."""
2628

27-
catalog_node: CatalogTable
29+
catalog_node: CatalogNodes
2830
original_file_path: str
2931
unique_id: str
3032

src/dbt_bouncer/checks/catalog/check_catalog_sources.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@
1313

1414
with warnings.catch_warnings():
1515
warnings.filterwarnings("ignore", category=UserWarning)
16-
from dbt_artifacts_parser.parsers.catalog.catalog_v1 import CatalogTable
16+
from dbt_artifacts_parser.parsers.catalog.catalog_v1 import (
17+
Nodes as CatalogNodes,
18+
)
1719

1820

1921
class CheckSourceColumnsAreAllDocumented(BaseCheck):
2022
"""All columns in a source should be included in the source's properties file, i.e. `.yml` file.
2123
2224
Receives:
23-
catalog_source (CatalogTable): The CatalogTable object to check.
25+
catalog_source (CatalogNodes): The CatalogNodes object to check.
2426
sources (List[DbtBouncerSourceBase]): List of DbtBouncerSourceBase objects parsed from `catalog.json`.
2527
2628
Other Parameters:
@@ -36,7 +38,7 @@ class CheckSourceColumnsAreAllDocumented(BaseCheck):
3638
3739
"""
3840

39-
catalog_source: "CatalogTable" = Field(default=None)
41+
catalog_source: "CatalogNodes" = Field(default=None)
4042
name: Literal["check_source_columns_are_all_documented"]
4143
sources: List["DbtBouncerSourceBase"] = Field(default=[])
4244

src/dbt_bouncer/checks/catalog/check_columns.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
with warnings.catch_warnings():
1010
warnings.filterwarnings("ignore", category=UserWarning)
11-
from dbt_artifacts_parser.parsers.catalog.catalog_v1 import CatalogTable
11+
from dbt_artifacts_parser.parsers.catalog.catalog_v1 import (
12+
Nodes as CatalogNodes,
13+
)
1214
from dbt_bouncer.artifact_parsers.parsers_manifest import (
1315
DbtBouncerModelBase,
1416
DbtBouncerTestBase,
@@ -23,7 +25,7 @@ class CheckColumnDescriptionPopulated(BaseCheck):
2325
"""Columns must have a populated description.
2426
2527
Receives:
26-
catalog_node (CatalogTable): The CatalogTable object to check.
28+
catalog_node (CatalogNodes): The CatalogNodes object to check.
2729
models (List[DbtBouncerModelBase]): List of DbtBouncerModelBase objects parsed from `manifest.json`.
2830
2931
Other Parameters:
@@ -40,7 +42,7 @@ class CheckColumnDescriptionPopulated(BaseCheck):
4042
4143
"""
4244

43-
catalog_node: "CatalogTable" = Field(default=None)
45+
catalog_node: "CatalogNodes" = Field(default=None)
4446
models: List["DbtBouncerModelBase"] = Field(default=[])
4547
name: Literal["check_column_description_populated"]
4648

@@ -69,7 +71,7 @@ class CheckColumnHasSpecifiedTest(BaseCheck):
6971
test_name (str): Name of the test to check for.
7072
7173
Receives:
72-
catalog_node (CatalogTable): The CatalogTable object to check.
74+
catalog_node (CatalogNodes): The CatalogNodes object to check.
7375
tests (List[DbtBouncerTestBase]): List of DbtBouncerTestBase objects parsed from `manifest.json`.
7476
7577
Other Parameters:
@@ -87,7 +89,7 @@ class CheckColumnHasSpecifiedTest(BaseCheck):
8789
8890
"""
8991

90-
catalog_node: "CatalogTable" = Field(default=None)
92+
catalog_node: "CatalogNodes" = Field(default=None)
9193
column_name_pattern: str
9294
name: Literal["check_column_has_specified_test"]
9395
test_name: str
@@ -126,7 +128,7 @@ class CheckColumnNameCompliesToColumnType(BaseCheck):
126128
types (List[str]): List of data types to check.
127129
128130
Receives:
129-
catalog_node (CatalogTable): The CatalogTable object to check.
131+
catalog_node (CatalogNodes): The CatalogNodes object to check.
130132
131133
Other Parameters:
132134
exclude (Optional[str]): Regex pattern to match the model path. Model paths that match the pattern will not be checked.
@@ -166,7 +168,7 @@ class CheckColumnNameCompliesToColumnType(BaseCheck):
166168
167169
"""
168170

169-
catalog_node: "CatalogTable" = Field(default=None)
171+
catalog_node: "CatalogNodes" = Field(default=None)
170172
column_name_pattern: str
171173
name: Literal["check_column_name_complies_to_column_type"]
172174
types: List[str]
@@ -187,7 +189,7 @@ class CheckColumnsAreAllDocumented(BaseCheck):
187189
"""All columns in a model should be included in the model's properties file, i.e. `.yml` file.
188190
189191
Receives:
190-
catalog_node (CatalogTable): The CatalogTable object to check.
192+
catalog_node (CatalogNodes): The CatalogNodes object to check.
191193
models (List[DbtBouncerModel]): List of DbtBouncerModel objects parsed from `manifest.json`.
192194
193195
Other Parameters:
@@ -203,7 +205,7 @@ class CheckColumnsAreAllDocumented(BaseCheck):
203205
204206
"""
205207

206-
catalog_node: "CatalogTable" = Field(default=None)
208+
catalog_node: "CatalogNodes" = Field(default=None)
207209
models: List["DbtBouncerModelBase"] = Field(default=[])
208210
name: Literal["check_columns_are_all_documented"]
209211

@@ -225,7 +227,7 @@ class CheckColumnsAreDocumentedInPublicModels(BaseCheck):
225227
"""Columns should have a populated description in public models.
226228
227229
Receives:
228-
catalog_node (CatalogTable): The CatalogTable object to check.
230+
catalog_node (CatalogNodes): The CatalogNodes object to check.
229231
models (List[DbtBouncerModel]): List of DbtBouncerModel objects parsed from `manifest.json`.
230232
231233
Other Parameters:
@@ -241,7 +243,7 @@ class CheckColumnsAreDocumentedInPublicModels(BaseCheck):
241243
242244
"""
243245

244-
catalog_node: "CatalogTable" = Field(default=None)
246+
catalog_node: "CatalogNodes" = Field(default=None)
245247
models: List["DbtBouncerModelBase"] = Field(default=[])
246248
name: Literal["check_columns_are_documented_in_public_models"]
247249

src/dbt_bouncer/config_file_validator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def validate_conf(
226226
with warnings.catch_warnings():
227227
warnings.filterwarnings("ignore", category=UserWarning)
228228
from dbt_artifacts_parser.parsers.catalog.catalog_v1 import (
229-
CatalogTable, # noqa: F401
229+
Nodes as CatalogNodes, # noqa: F401
230230
)
231231
if "manifest_checks" in check_categories:
232232
import dbt_bouncer.checks.manifest

tests/unit/checks/catalog/test_catalog_sources.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
with warnings.catch_warnings():
77
warnings.filterwarnings("ignore", category=UserWarning)
8-
from dbt_artifacts_parser.parsers.catalog.catalog_v1 import CatalogTable
8+
from dbt_artifacts_parser.parsers.catalog.catalog_v1 import Nodes as CatalogNodes
99

1010
from dbt_bouncer.artifact_parsers.dbt_cloud.manifest_latest import Sources
1111
from dbt_bouncer.artifact_parsers.parsers_manifest import (
@@ -22,7 +22,7 @@
2222
("catalog_source", "sources", "expectation"),
2323
[
2424
(
25-
CatalogTable(
25+
CatalogNodes(
2626
**{
2727
"columns": {
2828
"col_1": {
@@ -74,7 +74,7 @@
7474
does_not_raise(),
7575
),
7676
(
77-
CatalogTable(
77+
CatalogNodes(
7878
**{
7979
"columns": {
8080
"col_1": {

tests/unit/checks/catalog/test_columns.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
with warnings.catch_warnings():
77
warnings.filterwarnings("ignore", category=UserWarning)
8-
from dbt_artifacts_parser.parsers.catalog.catalog_v1 import CatalogTable
8+
from dbt_artifacts_parser.parsers.catalog.catalog_v1 import Nodes as CatalogNodes
99

1010

1111
from dbt_bouncer.artifact_parsers.dbt_cloud.manifest_latest import Nodes4, Nodes6
@@ -34,7 +34,7 @@
3434
("catalog_node", "models", "expectation"),
3535
[
3636
(
37-
CatalogTable(
37+
CatalogNodes(
3838
**{
3939
"columns": {
4040
"col_1": {
@@ -90,7 +90,7 @@
9090
does_not_raise(),
9191
),
9292
(
93-
CatalogTable(
93+
CatalogNodes(
9494
**{
9595
"columns": {
9696
"col_1": {
@@ -159,7 +159,7 @@ def test_check_column_description_populated(catalog_node, models, expectation):
159159
("catalog_node", "column_name_pattern", "test_name", "tests", "expectation"),
160160
[
161161
(
162-
CatalogTable(
162+
CatalogNodes(
163163
**{
164164
"columns": {
165165
"col_1": {
@@ -208,7 +208,7 @@ def test_check_column_description_populated(catalog_node, models, expectation):
208208
does_not_raise(),
209209
),
210210
(
211-
CatalogTable(
211+
CatalogNodes(
212212
**{
213213
"columns": {
214214
"col_1": {
@@ -279,7 +279,7 @@ def test_check_column_has_specified_test(
279279
("catalog_node", "models", "expectation"),
280280
[
281281
(
282-
CatalogTable(
282+
CatalogNodes(
283283
**{
284284
"columns": {
285285
"col_1": {
@@ -333,7 +333,7 @@ def test_check_column_has_specified_test(
333333
does_not_raise(),
334334
),
335335
(
336-
CatalogTable(
336+
CatalogNodes(
337337
**{
338338
"columns": {
339339
"col_1": {
@@ -396,7 +396,7 @@ def test_check_columns_are_all_documented(catalog_node, models, expectation):
396396
("catalog_node", "models", "expectation"),
397397
[
398398
(
399-
CatalogTable(
399+
CatalogNodes(
400400
**{
401401
"columns": {
402402
"col_1": {
@@ -442,7 +442,7 @@ def test_check_columns_are_all_documented(catalog_node, models, expectation):
442442
does_not_raise(),
443443
),
444444
(
445-
CatalogTable(
445+
CatalogNodes(
446446
**{
447447
"columns": {
448448
"col_1": {
@@ -517,7 +517,7 @@ def test_check_columns_are_documented_in_public_models(
517517
("catalog_node", "column_name_pattern", "types", "expectation"),
518518
[
519519
(
520-
CatalogTable(
520+
CatalogNodes(
521521
**{
522522
"columns": {
523523
"col_1_date": {
@@ -540,7 +540,7 @@ def test_check_columns_are_documented_in_public_models(
540540
does_not_raise(),
541541
),
542542
(
543-
CatalogTable(
543+
CatalogNodes(
544544
**{
545545
"columns": {
546546
"col_1_date": {
@@ -573,7 +573,7 @@ def test_check_columns_are_documented_in_public_models(
573573
does_not_raise(),
574574
),
575575
(
576-
CatalogTable(
576+
CatalogNodes(
577577
**{
578578
"columns": {
579579
"col_1": {

tests/unit/test_runner.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
with warnings.catch_warnings():
66
warnings.filterwarnings("ignore", category=UserWarning)
77
from dbt_artifacts_parser.parsers.catalog.catalog_v1 import (
8-
CatalogTable, # noqa: F401
8+
Nodes as CatalogNodes, # noqa: F401
99
)
1010
from unittest.mock import MagicMock
1111

@@ -55,7 +55,7 @@ def test_runner_coverage(caplog, tmp_path):
5555
warnings.filterwarnings("ignore", category=UserWarning)
5656
from dbt_artifacts_parser.parser import parse_manifest
5757
from dbt_artifacts_parser.parsers.catalog.catalog_v1 import (
58-
CatalogTable, # noqa: F401
58+
Nodes as CatalogNodes, # noqa: F401
5959
)
6060
from dbt_bouncer.artifact_parsers.dbt_cloud.manifest_latest import ( # noqa: F401
6161
Exposures,
@@ -189,7 +189,7 @@ def test_runner_failure():
189189
warnings.filterwarnings("ignore", category=UserWarning)
190190
from dbt_artifacts_parser.parser import parse_manifest
191191
from dbt_artifacts_parser.parsers.catalog.catalog_v1 import (
192-
CatalogTable, # noqa: F401
192+
Nodes as CatalogNodes, # noqa: F401
193193
)
194194
from dbt_bouncer.artifact_parsers.dbt_cloud.manifest_latest import ( # noqa: F401
195195
Exposures,
@@ -315,7 +315,7 @@ def test_runner_success():
315315
warnings.filterwarnings("ignore", category=UserWarning)
316316
from dbt_artifacts_parser.parser import parse_manifest
317317
from dbt_artifacts_parser.parsers.catalog.catalog_v1 import (
318-
CatalogTable, # noqa: F401
318+
Nodes as CatalogNodes, # noqa: F401
319319
)
320320
from dbt_bouncer.artifact_parsers.dbt_cloud.manifest_latest import ( # noqa: F401
321321
Exposures,
@@ -440,7 +440,7 @@ def test_runner_windows(caplog, tmp_path):
440440
warnings.filterwarnings("ignore", category=UserWarning)
441441
from dbt_artifacts_parser.parser import parse_manifest
442442
from dbt_artifacts_parser.parsers.catalog.catalog_v1 import (
443-
CatalogTable, # noqa: F401
443+
Nodes as CatalogNodes, # noqa: F401
444444
)
445445

446446
DbtBouncerConf.model_rebuild()

0 commit comments

Comments
 (0)