dbt-bouncer 1.7.0__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.
Files changed (32) hide show
  1. dbt_bouncer-1.7.0/LICENSE +21 -0
  2. dbt_bouncer-1.7.0/PKG-INFO +149 -0
  3. dbt_bouncer-1.7.0/README.md +113 -0
  4. dbt_bouncer-1.7.0/pyproject.toml +193 -0
  5. dbt_bouncer-1.7.0/src/dbt_bouncer/__init__.py +1 -0
  6. dbt_bouncer-1.7.0/src/dbt_bouncer/artifact_parsers/dbt_cloud/README.md +3 -0
  7. dbt_bouncer-1.7.0/src/dbt_bouncer/artifact_parsers/dbt_cloud/manifest_latest.py +3895 -0
  8. dbt_bouncer-1.7.0/src/dbt_bouncer/artifact_parsers/dbt_cloud/run_results_latest.py +91 -0
  9. dbt_bouncer-1.7.0/src/dbt_bouncer/artifact_parsers/parsers_catalog.py +80 -0
  10. dbt_bouncer-1.7.0/src/dbt_bouncer/artifact_parsers/parsers_common.py +197 -0
  11. dbt_bouncer-1.7.0/src/dbt_bouncer/artifact_parsers/parsers_manifest.py +296 -0
  12. dbt_bouncer-1.7.0/src/dbt_bouncer/artifact_parsers/parsers_run_results.py +111 -0
  13. dbt_bouncer-1.7.0/src/dbt_bouncer/check_base.py +26 -0
  14. dbt_bouncer-1.7.0/src/dbt_bouncer/checks/catalog/check_catalog_sources.py +57 -0
  15. dbt_bouncer-1.7.0/src/dbt_bouncer/checks/catalog/check_columns.py +276 -0
  16. dbt_bouncer-1.7.0/src/dbt_bouncer/checks/common.py +7 -0
  17. dbt_bouncer-1.7.0/src/dbt_bouncer/checks/manifest/check_exposures.py +110 -0
  18. dbt_bouncer-1.7.0/src/dbt_bouncer/checks/manifest/check_lineage.py +139 -0
  19. dbt_bouncer-1.7.0/src/dbt_bouncer/checks/manifest/check_macros.py +311 -0
  20. dbt_bouncer-1.7.0/src/dbt_bouncer/checks/manifest/check_metadata.py +56 -0
  21. dbt_bouncer-1.7.0/src/dbt_bouncer/checks/manifest/check_models.py +1007 -0
  22. dbt_bouncer-1.7.0/src/dbt_bouncer/checks/manifest/check_semantic_models.py +55 -0
  23. dbt_bouncer-1.7.0/src/dbt_bouncer/checks/manifest/check_sources.py +382 -0
  24. dbt_bouncer-1.7.0/src/dbt_bouncer/checks/manifest/check_unit_tests.py +203 -0
  25. dbt_bouncer-1.7.0/src/dbt_bouncer/checks/run_results/check_run_results.py +104 -0
  26. dbt_bouncer-1.7.0/src/dbt_bouncer/config_file_parser.py +137 -0
  27. dbt_bouncer-1.7.0/src/dbt_bouncer/config_file_validator.py +290 -0
  28. dbt_bouncer-1.7.0/src/dbt_bouncer/logger.py +59 -0
  29. dbt_bouncer-1.7.0/src/dbt_bouncer/main.py +165 -0
  30. dbt_bouncer-1.7.0/src/dbt_bouncer/runner.py +244 -0
  31. dbt_bouncer-1.7.0/src/dbt_bouncer/utils.py +243 -0
  32. dbt_bouncer-1.7.0/src/dbt_bouncer/version.py +8 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Pádraic Slattery
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,149 @@
1
+ Metadata-Version: 2.3
2
+ Name: dbt-bouncer
3
+ Version: 1.7.0
4
+ Summary: Configure and enforce conventions for your dbt project.
5
+ License: MIT
6
+ Keywords: python,cli,dbt,CI/CD
7
+ Author: Padraic Slattery
8
+ Author-email: pgoslatara@gmail.com
9
+ Maintainer: Padraic Slattery
10
+ Maintainer-email: pgoslatara@gmail.com
11
+ Requires-Python: >=3.9,<3.14
12
+ Classifier: Programming Language :: Python
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Requires-Dist: click (<9)
21
+ Requires-Dist: dbt-artifacts-parser (>=0.8)
22
+ Requires-Dist: jinja2 (>=3,<4)
23
+ Requires-Dist: jinja2-simple-tags (<1)
24
+ Requires-Dist: levenshtein (>=0.26.1,<1)
25
+ Requires-Dist: packaging (<25)
26
+ Requires-Dist: poetry (>=2.0.1,<3.0.0)
27
+ Requires-Dist: progress
28
+ Requires-Dist: pydantic (>=2,<3)
29
+ Requires-Dist: pyyaml (<7)
30
+ Requires-Dist: requests (>=2,<3)
31
+ Requires-Dist: semver (<4)
32
+ Requires-Dist: tabulate (<1)
33
+ Requires-Dist: toml (<1)
34
+ Description-Content-Type: text/markdown
35
+
36
+ <p align="center">
37
+ <img src="https://github.com/godatadriven/dbt-bouncer/raw/main/docs/assets/logo.svg" alt="dbt-bouncer logo" width="500"/>
38
+ </p>
39
+
40
+
41
+ <h1 align="center">
42
+ dbt-bouncer
43
+ </h1>
44
+ <h2 align="center">
45
+ Configure and enforce conventions for your dbt project.
46
+ </h2>
47
+
48
+ <div align="center">
49
+ <a>
50
+ <img src="https://img.shields.io/github/release/godatadriven/dbt-bouncer.svg?logo=github">
51
+ </a>
52
+ <a>
53
+ <img src="https://img.shields.io/badge/License-MIT-yellow.svg">
54
+ </a>
55
+ <a>
56
+ <img src="https://img.shields.io/github/last-commit/godatadriven/dbt-bouncer/main">
57
+ </a>
58
+ <a>
59
+ <img src="https://img.shields.io/github/commits-since/godatadriven/dbt-bouncer/latest">
60
+ </a>
61
+ </div>
62
+
63
+ <div align="center">
64
+ <a>
65
+ <img alt="dbt-core" src="https://img.shields.io/badge/dbt--core%20-%3E%3D1.6-333?logo=dbt">
66
+ </a>
67
+ <a>
68
+ <img alt="dbt Cloud Supported" src="https://img.shields.io/badge/dbt%20Cloud%20-Supported-ff694a?logo=dbt">
69
+ </a>
70
+ <a>
71
+ <img alt="Docker Supported" src="https://img.shields.io/badge/Docker%20-Supported-0db7ed?logo=docker">
72
+ </a>
73
+ <a>
74
+ <img alt="GitHub Supported" src="https://img.shields.io/badge/GitHub%20-Supported-333?logo=github">
75
+ </a>
76
+ </div>
77
+
78
+ <div align="center">
79
+ <a>
80
+ <img src="https://github.com/godatadriven/dbt-bouncer/actions/workflows/merge_pipeline.yml/badge.svg">
81
+ </a>
82
+ <a>
83
+ <img src="https://github.com/godatadriven/dbt-bouncer/actions/workflows/post_release_pipeline.yml/badge.svg">
84
+ </a>
85
+ <a>
86
+ <img src="https://img.shields.io/badge/style-ruff-41B5BE?style=flat">
87
+ </a>
88
+ <a>
89
+ <img src="https://www.aschey.tech/tokei/github/godatadriven/dbt-bouncer?category=code">
90
+ </a>
91
+ </div>
92
+ <br/>
93
+
94
+ ## Documentation
95
+
96
+ All documentation can be found on `dbt-bouncer` [documentation website](https://godatadriven.github.io/dbt-bouncer/).
97
+
98
+ ### TLDR
99
+
100
+ 1. Install `dbt-bouncer`:
101
+
102
+ ```shell
103
+ pip install dbt-bouncer
104
+ ```
105
+
106
+ 1. `dbt-bouncer` requires a `manifest.json` file. If not already present, run:
107
+
108
+ ```shell
109
+ dbt parse
110
+ ```
111
+
112
+ 1. Create a `dbt-bouncer.yml` config file:
113
+
114
+ ```yml
115
+ manifest_checks:
116
+ - name: check_model_directories
117
+ include: ^models
118
+ permitted_sub_directories:
119
+ - intermediate
120
+ - marts
121
+ - staging
122
+ - name: check_model_names
123
+ include: ^models/staging
124
+ model_name_pattern: ^stg_
125
+ ```
126
+
127
+ 1. Run `dbt-bouncer`:
128
+
129
+ ```
130
+ $ dbt-bouncer
131
+
132
+ [...]
133
+ Running checks... |################################| 20/20
134
+ Done. SUCCESS=19 WARN=0 ERROR=1
135
+ Failed checks:
136
+ | Check name | Severity | Failure message |
137
+ |--------------------------|----------|---------------------------------------------------------------------------------------|
138
+ | check_model_directories: | error | AssertionError: `model` is located in `utilities`, this is not a valid sub-directory. |
139
+ ```
140
+
141
+ ## Reporting bugs and contributing code
142
+
143
+ - Want to report a bug or request a feature? Let us know and open [an issue](https://github.com/godatadriven/dbt-bouncer/issues/new/choose).
144
+ - Want to help us build `dbt-bouncer`? Check out the [Contributing Guide](https://github.com/godatadriven/dbt-bouncer/blob/HEAD/docs/CONTRIBUTING.md).
145
+
146
+ ## Code of Conduct
147
+
148
+ Everyone interacting in `dbt-bouncer`'s codebase, issue trackers, chat rooms, and mailing lists is expected to follow the [Code of Conduct](./CODE_OF_CONDUCT.md).
149
+
@@ -0,0 +1,113 @@
1
+ <p align="center">
2
+ <img src="https://github.com/godatadriven/dbt-bouncer/raw/main/docs/assets/logo.svg" alt="dbt-bouncer logo" width="500"/>
3
+ </p>
4
+
5
+
6
+ <h1 align="center">
7
+ dbt-bouncer
8
+ </h1>
9
+ <h2 align="center">
10
+ Configure and enforce conventions for your dbt project.
11
+ </h2>
12
+
13
+ <div align="center">
14
+ <a>
15
+ <img src="https://img.shields.io/github/release/godatadriven/dbt-bouncer.svg?logo=github">
16
+ </a>
17
+ <a>
18
+ <img src="https://img.shields.io/badge/License-MIT-yellow.svg">
19
+ </a>
20
+ <a>
21
+ <img src="https://img.shields.io/github/last-commit/godatadriven/dbt-bouncer/main">
22
+ </a>
23
+ <a>
24
+ <img src="https://img.shields.io/github/commits-since/godatadriven/dbt-bouncer/latest">
25
+ </a>
26
+ </div>
27
+
28
+ <div align="center">
29
+ <a>
30
+ <img alt="dbt-core" src="https://img.shields.io/badge/dbt--core%20-%3E%3D1.6-333?logo=dbt">
31
+ </a>
32
+ <a>
33
+ <img alt="dbt Cloud Supported" src="https://img.shields.io/badge/dbt%20Cloud%20-Supported-ff694a?logo=dbt">
34
+ </a>
35
+ <a>
36
+ <img alt="Docker Supported" src="https://img.shields.io/badge/Docker%20-Supported-0db7ed?logo=docker">
37
+ </a>
38
+ <a>
39
+ <img alt="GitHub Supported" src="https://img.shields.io/badge/GitHub%20-Supported-333?logo=github">
40
+ </a>
41
+ </div>
42
+
43
+ <div align="center">
44
+ <a>
45
+ <img src="https://github.com/godatadriven/dbt-bouncer/actions/workflows/merge_pipeline.yml/badge.svg">
46
+ </a>
47
+ <a>
48
+ <img src="https://github.com/godatadriven/dbt-bouncer/actions/workflows/post_release_pipeline.yml/badge.svg">
49
+ </a>
50
+ <a>
51
+ <img src="https://img.shields.io/badge/style-ruff-41B5BE?style=flat">
52
+ </a>
53
+ <a>
54
+ <img src="https://www.aschey.tech/tokei/github/godatadriven/dbt-bouncer?category=code">
55
+ </a>
56
+ </div>
57
+ <br/>
58
+
59
+ ## Documentation
60
+
61
+ All documentation can be found on `dbt-bouncer` [documentation website](https://godatadriven.github.io/dbt-bouncer/).
62
+
63
+ ### TLDR
64
+
65
+ 1. Install `dbt-bouncer`:
66
+
67
+ ```shell
68
+ pip install dbt-bouncer
69
+ ```
70
+
71
+ 1. `dbt-bouncer` requires a `manifest.json` file. If not already present, run:
72
+
73
+ ```shell
74
+ dbt parse
75
+ ```
76
+
77
+ 1. Create a `dbt-bouncer.yml` config file:
78
+
79
+ ```yml
80
+ manifest_checks:
81
+ - name: check_model_directories
82
+ include: ^models
83
+ permitted_sub_directories:
84
+ - intermediate
85
+ - marts
86
+ - staging
87
+ - name: check_model_names
88
+ include: ^models/staging
89
+ model_name_pattern: ^stg_
90
+ ```
91
+
92
+ 1. Run `dbt-bouncer`:
93
+
94
+ ```
95
+ $ dbt-bouncer
96
+
97
+ [...]
98
+ Running checks... |################################| 20/20
99
+ Done. SUCCESS=19 WARN=0 ERROR=1
100
+ Failed checks:
101
+ | Check name | Severity | Failure message |
102
+ |--------------------------|----------|---------------------------------------------------------------------------------------|
103
+ | check_model_directories: | error | AssertionError: `model` is located in `utilities`, this is not a valid sub-directory. |
104
+ ```
105
+
106
+ ## Reporting bugs and contributing code
107
+
108
+ - Want to report a bug or request a feature? Let us know and open [an issue](https://github.com/godatadriven/dbt-bouncer/issues/new/choose).
109
+ - Want to help us build `dbt-bouncer`? Check out the [Contributing Guide](https://github.com/godatadriven/dbt-bouncer/blob/HEAD/docs/CONTRIBUTING.md).
110
+
111
+ ## Code of Conduct
112
+
113
+ Everyone interacting in `dbt-bouncer`'s codebase, issue trackers, chat rooms, and mailing lists is expected to follow the [Code of Conduct](./CODE_OF_CONDUCT.md).
@@ -0,0 +1,193 @@
1
+ [project]
2
+ authors = [{name="Padraic Slattery", email= "pgoslatara@gmail.com"}]
3
+ classifiers = [
4
+ "Programming Language :: Python",
5
+ "Programming Language :: Python :: 3",
6
+ "Programming Language :: Python :: 3 :: Only",
7
+ "Programming Language :: Python :: 3.9",
8
+ "Programming Language :: Python :: 3.10",
9
+ "Programming Language :: Python :: 3.11",
10
+ "Programming Language :: Python :: 3.12",
11
+ "Programming Language :: Python :: 3.13",
12
+ ]
13
+ dependencies =[
14
+ "click (<9)",
15
+ "dbt-artifacts-parser (>=0.8)",
16
+ "jinja2 (>=3,<4)",
17
+ "jinja2-simple-tags (<1)",
18
+ "levenshtein (>=0.26.1,<1)",
19
+ "packaging (<25)",
20
+ "progress",
21
+ "pydantic (>=2,<3)",
22
+ "pyyaml (<7)",
23
+ "requests (>=2,<3)",
24
+ "tabulate (<1)",
25
+ "toml (<1)",
26
+ "semver (<4)",
27
+ "poetry (>=2.0.1,<3.0.0)"
28
+ ]
29
+ description = "Configure and enforce conventions for your dbt project."
30
+ keywords = [
31
+ "python",
32
+ "cli",
33
+ "dbt",
34
+ "CI/CD",
35
+ ]
36
+ license ="MIT"
37
+ maintainers = [{name="Padraic Slattery",email="pgoslatara@gmail.com"}]
38
+ name = "dbt-bouncer"
39
+ readme = "README.md"
40
+ repository = "https://github.com/godatadriven/dbt-bouncer"
41
+ requires-python = ">=3.9,<3.14"
42
+ version = "1.7.0"
43
+
44
+ [project.scripts]
45
+ dbt-bouncer = "dbt_bouncer.main:cli"
46
+
47
+ [tool.black]
48
+ line-length = 99
49
+ include = '/project$|\.pyi?$'
50
+ exclude = '''
51
+ /(
52
+ \.git
53
+ | \.hg
54
+ | \.eggs
55
+ | \.mypy_cache
56
+ | \.tox
57
+ | \.venv
58
+ | \.vscode
59
+ | _build
60
+ | buck-out
61
+ | build
62
+ | dist
63
+ )/
64
+ '''
65
+
66
+ [tool.coverage.report]
67
+ exclude_lines = [
68
+ "if TYPE_CHECKING:",
69
+ ]
70
+
71
+ [tool.dbt-bouncer]
72
+ dbt_artifacts_dir = "dbt_project/target"
73
+
74
+ [[tool.dbt-bouncer.manifest_checks]]
75
+ name = "check_model_has_unique_test"
76
+
77
+ [[tool.dbt-bouncer.manifest_checks]]
78
+ name = "check_model_names"
79
+ include = "^staging"
80
+ model_name_pattern = "^stg_"
81
+
82
+ [tool.isort]
83
+ profile = "black"
84
+
85
+ [tool.mypy]
86
+ follow_imports = "silent"
87
+ warn_redundant_casts = true
88
+ warn_unused_ignores = true
89
+ disallow_any_generics = true
90
+ check_untyped_defs = true
91
+ no_implicit_reexport = true
92
+ plugins = [
93
+ "pydantic.mypy"
94
+ ]
95
+
96
+ [[tool.mypy.overrides]]
97
+ ignore_missing_imports = true
98
+ module = "dbt_artifacts_parser.*"
99
+
100
+ [tool.poetry]
101
+ packages = [
102
+ {include = "dbt_bouncer", from = "src"},
103
+ ]
104
+ requires-poetry = ">=2.0.0"
105
+
106
+ [tool.poetry.group.dev.dependencies]
107
+ autoflake = "^2"
108
+ black = "^24"
109
+ dbt-core = "^1"
110
+ dbt-duckdb = "^1"
111
+ isort = "^5"
112
+ mypy = "^1"
113
+ pex = "^2"
114
+ pre-commit = ">=3,<5"
115
+ pytest = "<9"
116
+ pytest-cov = ">=5,<7"
117
+ pytest-xdist = "^3"
118
+ ruff = "^0"
119
+ sh = "^2"
120
+ "shandy-sqlfmt" = {version = "^0", extras=["shandy-sqlfmt[jinjafmt]"]}
121
+ types-PyYaml = "^6"
122
+ types-tabulate = "^0"
123
+ types-toml = "^0"
124
+
125
+ [tool.poetry.group.docs.dependencies]
126
+ mike = "^2"
127
+ mkdocs = "^1"
128
+ mkdocstrings = {extras = ["python"], version = "^0"}
129
+ mkdocs-click = "^0"
130
+ mkdocs-git-revision-date-localized-plugin = "^1"
131
+ mkdocs-material = "^9"
132
+ pymdown-extensions = {extras = ["details"], version = "^10"}
133
+
134
+ [tool.poetry_bumpversion.file."./src/dbt_bouncer/version.py"]
135
+ [tool.poetry_bumpversion.file."action.yml"]
136
+
137
+ [tool.ruff]
138
+ exclude = [
139
+ ".bzr",
140
+ ".direnv",
141
+ ".eggs",
142
+ ".git",
143
+ ".git-rewrite",
144
+ ".hg",
145
+ ".ipynb_checkpoints",
146
+ ".mypy_cache",
147
+ ".nox",
148
+ ".pants.d",
149
+ ".pyenv",
150
+ ".pytest_cache",
151
+ ".pytype",
152
+ ".ruff_cache",
153
+ ".svn",
154
+ ".tox",
155
+ ".venv",
156
+ ".vscode",
157
+ "__pypackages__",
158
+ "_build",
159
+ "buck-out",
160
+ "build",
161
+ "dist",
162
+ "node_modules",
163
+ "site-packages",
164
+ "src/dbt_bouncer/artifact_parsers/dbt_cloud",
165
+ "venv",
166
+ ]
167
+ line-length = 88
168
+ indent-width = 4
169
+ target-version = "py38"
170
+
171
+ [tool.ruff.lint]
172
+ ignore = ["COM812", "D100", "D203", "D213", "D406", "D407", "D409", "E501", "G004", "LOG015", "S101"]
173
+ preview=true
174
+ 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"]
175
+ unfixable = ["B"]
176
+
177
+ [tool.ruff.lint.per-file-ignores]
178
+ "__init__.py" = ["E402"]
179
+ "src/dbt_bouncer/checks/*" = ["ARG001", "D101", "D401", "D417"]
180
+ "src/dbt_bouncer/parsers.py" = ["TCH002"]
181
+ "tests/*" = ["D100", "D103", "D104", "E402"]
182
+
183
+ [tool.ruff.format]
184
+ docstring-code-format = false
185
+ docstring-code-line-length = "dynamic"
186
+ indent-style = "space"
187
+ line-ending = "auto"
188
+ quote-style = "double"
189
+ skip-magic-trailing-comma = false
190
+
191
+ [build-system]
192
+ requires = ["poetry-core>=2.0.0"]
193
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1 @@
1
+ """Package for `dbt-bouncer`."""
@@ -0,0 +1,3 @@
1
+ dbt Cloud now supports a "versionless" mode. Unfortunately `dbt-artifacts-parser` does not support any modifications to the schema od dbt artifacts using this mode, see [here](https://github.com/yu-iskw/dbt-artifacts-parser/pull/112#issuecomment-2360298424) for more info.
2
+
3
+ The purpose of this directory is to extend `dbt-artifacts-parser` to support dbt Cloud versionless mode by modifying the expected schema of dbt artifacts.