dbt-data-engineering-toolkit-compiler 3.0.1__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 (72) hide show
  1. dbt_data_engineering_toolkit_compiler-3.0.1/LICENSE +21 -0
  2. dbt_data_engineering_toolkit_compiler-3.0.1/PKG-INFO +105 -0
  3. dbt_data_engineering_toolkit_compiler-3.0.1/README.md +50 -0
  4. dbt_data_engineering_toolkit_compiler-3.0.1/pyproject.toml +122 -0
  5. dbt_data_engineering_toolkit_compiler-3.0.1/setup.cfg +4 -0
  6. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/__init__.py +5 -0
  7. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/__main__.py +3 -0
  8. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/adapters.py +352 -0
  9. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/brokers/__init__.py +16 -0
  10. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/brokers/commands.py +46 -0
  11. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/brokers/datacontracts.py +95 -0
  12. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/brokers/dependencies.py +97 -0
  13. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/brokers/files.py +92 -0
  14. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/brokers/projects.py +128 -0
  15. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/brokers/target_workbooks.py +622 -0
  16. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/brokers/template_workbooks.py +989 -0
  17. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/brokers/workbook_edits.py +106 -0
  18. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/brokers/workbooks.py +92 -0
  19. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/errors.py +128 -0
  20. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/exposers/__init__.py +1 -0
  21. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/exposers/cli.py +381 -0
  22. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/generation.py +120 -0
  23. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/models.py +271 -0
  24. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/operational.py +59 -0
  25. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/prove.py +176 -0
  26. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/py.typed +1 -0
  27. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/registry.py +118 -0
  28. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/resources/data_product.xlsx +0 -0
  29. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/resources/data_product_multi_source_sample.xlsx +0 -0
  30. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/resources/data_product_sample.xlsx +0 -0
  31. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/resources/operators.yml +240 -0
  32. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/__init__.py +1 -0
  33. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/application.py +466 -0
  34. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/emissions/__init__.py +5 -0
  35. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/emissions/common.py +61 -0
  36. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/emissions/contracts.py +217 -0
  37. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/emissions/generated_readme.py +117 -0
  38. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/emissions/project.py +119 -0
  39. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/emissions/project_config.py +120 -0
  40. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/emissions/schema.py +191 -0
  41. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/emissions/service.py +41 -0
  42. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/emissions/sql.py +304 -0
  43. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/generation.py +321 -0
  44. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/imports/__init__.py +21 -0
  45. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/imports/structures.py +554 -0
  46. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/validation/__init__.py +5 -0
  47. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/validation/common.py +128 -0
  48. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/validation/context.py +83 -0
  49. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/validation/mappings.py +264 -0
  50. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/validation/metadata_sources.py +161 -0
  51. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/validation/model_outputs.py +133 -0
  52. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/validation/models_schema.py +110 -0
  53. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/validation/quality_build.py +243 -0
  54. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/validation/relationships.py +166 -0
  55. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/validation/rules.py +134 -0
  56. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/validation/service.py +51 -0
  57. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/workbooks/__init__.py +5 -0
  58. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/workbooks/common.py +206 -0
  59. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/workbooks/governance.py +366 -0
  60. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/workbooks/mappings_rules.py +177 -0
  61. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/workbooks/product_schema.py +208 -0
  62. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/workbooks/service.py +96 -0
  63. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/services/workbooks/sources_models.py +106 -0
  64. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/version.py +17 -0
  65. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler/workbook_layout.py +4 -0
  66. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler.egg-info/PKG-INFO +105 -0
  67. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler.egg-info/SOURCES.txt +70 -0
  68. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler.egg-info/dependency_links.txt +1 -0
  69. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler.egg-info/entry_points.txt +2 -0
  70. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler.egg-info/requires.txt +47 -0
  71. dbt_data_engineering_toolkit_compiler-3.0.1/src/dbt_data_engineering_toolkit_compiler.egg-info/top_level.txt +1 -0
  72. dbt_data_engineering_toolkit_compiler-3.0.1/tests/test_local_package_resolution.py +25 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Systemizing Solutions and dbt_data_engineering_toolkit contributors
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,105 @@
1
+ Metadata-Version: 2.4
2
+ Name: dbt-data-engineering-toolkit-compiler
3
+ Version: 3.0.1
4
+ Summary: Compile BA-authored Excel data products into ODCS and readable dbt projects.
5
+ License-Expression: MIT
6
+ Keywords: dbt,data-contract,data-engineering,odcs,sql
7
+ Classifier: Development Status :: 5 - Production/Stable
8
+ Classifier: Environment :: Console
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Topic :: Database
14
+ Classifier: Typing :: Typed
15
+ Requires-Python: <3.15,>=3.11
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: datacontract-cli[excel]<2,>=1.1.3
19
+ Requires-Dist: dbt-core<2,>=1.10.6
20
+ Requires-Dist: dbt-duckdb<2,>=1.10
21
+ Requires-Dist: duckdb<1.5,>=1.4
22
+ Requires-Dist: openpyxl<4,>=3.1
23
+ Requires-Dist: pydantic<3,>=2.10
24
+ Requires-Dist: PyYAML<7,>=6
25
+ Requires-Dist: sqlfluff<5,>=3.4
26
+ Requires-Dist: sqlfluff-templater-dbt<5,>=3.4
27
+ Provides-Extra: athena
28
+ Requires-Dist: dbt-athena-community<2,>=1.10; extra == "athena"
29
+ Provides-Extra: bigquery
30
+ Requires-Dist: dbt-bigquery<2,>=1.10; extra == "bigquery"
31
+ Provides-Extra: clickhouse
32
+ Requires-Dist: dbt-clickhouse<2,>=1.10; extra == "clickhouse"
33
+ Provides-Extra: databricks
34
+ Requires-Dist: dbt-databricks<2,>=1.10; extra == "databricks"
35
+ Provides-Extra: duckdb
36
+ Requires-Dist: dbt-duckdb<2,>=1.10; extra == "duckdb"
37
+ Requires-Dist: duckdb<1.5,>=1.4; extra == "duckdb"
38
+ Provides-Extra: postgres
39
+ Requires-Dist: dbt-postgres<2,>=1.10; extra == "postgres"
40
+ Provides-Extra: redshift
41
+ Requires-Dist: dbt-redshift<2,>=1.10; extra == "redshift"
42
+ Provides-Extra: snowflake
43
+ Requires-Dist: dbt-snowflake<2,>=1.10; extra == "snowflake"
44
+ Provides-Extra: spark
45
+ Requires-Dist: dbt-spark[PyHive]<2,>=1.10; extra == "spark"
46
+ Provides-Extra: test
47
+ Requires-Dist: pyright<2,>=1.1.390; extra == "test"
48
+ Requires-Dist: pytest<10,>=8; extra == "test"
49
+ Requires-Dist: pytest-cov<8,>=6; extra == "test"
50
+ Requires-Dist: ruff<1,>=0.9; extra == "test"
51
+ Provides-Extra: release
52
+ Requires-Dist: build<2,>=1.2; extra == "release"
53
+ Requires-Dist: bumpver>=2024.1130; extra == "release"
54
+ Dynamic: license-file
55
+
56
+ # Data Engineering Toolkit compiler
57
+
58
+ The `det` CLI turns the controlled V2.3.0 official-ODCS Excel superset into
59
+ canonical ODCS, DET execution metadata, and a readable dbt project. It includes
60
+ safe questionnaire-based workbook creation, ODCS/DDL/dbt-to-Excel import and
61
+ merge-safe synchronization, source-schema import, cross-sheet semantic/type
62
+ validation, atomic post-sync generation, Data Contract synchronization, SQLFluff,
63
+ and the isolated `det prove` acceptance flow. Data Contract CLI, dbt Core,
64
+ DuckDB, and SQLFluff are default dependencies.
65
+
66
+ V2.3.0 makes the visible official `Quality` sheet authoritative, preserves
67
+ advanced per-rule ODCS values, supports eight production warehouse providers, and adds mandatory
68
+ 85.01% Python statement coverage. The generated dbt package has 98.53% DuckDB-scoped macro
69
+ implementation coverage plus 100% public-API direct execution coverage and supports dbt Core plus
70
+ Fusion-compatible projects. External resources
71
+ are isolated behind brokers; reusable services interpret workbooks and input
72
+ formats; independent components validate with stable diagnostic codes; and one
73
+ emitter owns each artifact family. The CLI remains a thin exposer over
74
+ `ToolkitApplication`.
75
+
76
+ ## Install
77
+
78
+ ```bash
79
+ python -m pip install dbt-data-engineering-toolkit-compiler==2.3.0
80
+ ```
81
+
82
+ The default installation includes Data Contract CLI, dbt Core, dbt-duckdb,
83
+ DuckDB, and SQLFluff. Install one additional warehouse adapter per deployment
84
+ environment, for example:
85
+
86
+ ```bash
87
+ python -m pip install "dbt-data-engineering-toolkit-compiler[snowflake]"
88
+ ```
89
+
90
+ Supported extras are `athena`, `bigquery`, `clickhouse`, `databricks`,
91
+ `duckdb`, `postgres`, `redshift`, `snowflake`, and `spark`.
92
+
93
+ ## Safe first workbook
94
+
95
+ ```bash
96
+ det workbook build data_product.xlsx --no-input
97
+ det validate data_product.xlsx
98
+ ```
99
+
100
+ The default is blank: it does not add Customer 360 sample data. Use
101
+ `--sample-customer-data` only when you explicitly want the demonstration.
102
+
103
+ Continue with `det --help` and `det workbook --help`. The source repository's
104
+ root README contains the complete workbook-to-ODCS-to-dbt walkthrough,
105
+ architecture, compatibility matrix, testing definitions, and deployment guide.
@@ -0,0 +1,50 @@
1
+ # Data Engineering Toolkit compiler
2
+
3
+ The `det` CLI turns the controlled V2.3.0 official-ODCS Excel superset into
4
+ canonical ODCS, DET execution metadata, and a readable dbt project. It includes
5
+ safe questionnaire-based workbook creation, ODCS/DDL/dbt-to-Excel import and
6
+ merge-safe synchronization, source-schema import, cross-sheet semantic/type
7
+ validation, atomic post-sync generation, Data Contract synchronization, SQLFluff,
8
+ and the isolated `det prove` acceptance flow. Data Contract CLI, dbt Core,
9
+ DuckDB, and SQLFluff are default dependencies.
10
+
11
+ V2.3.0 makes the visible official `Quality` sheet authoritative, preserves
12
+ advanced per-rule ODCS values, supports eight production warehouse providers, and adds mandatory
13
+ 85.01% Python statement coverage. The generated dbt package has 98.53% DuckDB-scoped macro
14
+ implementation coverage plus 100% public-API direct execution coverage and supports dbt Core plus
15
+ Fusion-compatible projects. External resources
16
+ are isolated behind brokers; reusable services interpret workbooks and input
17
+ formats; independent components validate with stable diagnostic codes; and one
18
+ emitter owns each artifact family. The CLI remains a thin exposer over
19
+ `ToolkitApplication`.
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ python -m pip install dbt-data-engineering-toolkit-compiler==2.3.0
25
+ ```
26
+
27
+ The default installation includes Data Contract CLI, dbt Core, dbt-duckdb,
28
+ DuckDB, and SQLFluff. Install one additional warehouse adapter per deployment
29
+ environment, for example:
30
+
31
+ ```bash
32
+ python -m pip install "dbt-data-engineering-toolkit-compiler[snowflake]"
33
+ ```
34
+
35
+ Supported extras are `athena`, `bigquery`, `clickhouse`, `databricks`,
36
+ `duckdb`, `postgres`, `redshift`, `snowflake`, and `spark`.
37
+
38
+ ## Safe first workbook
39
+
40
+ ```bash
41
+ det workbook build data_product.xlsx --no-input
42
+ det validate data_product.xlsx
43
+ ```
44
+
45
+ The default is blank: it does not add Customer 360 sample data. Use
46
+ `--sample-customer-data` only when you explicitly want the demonstration.
47
+
48
+ Continue with `det --help` and `det workbook --help`. The source repository's
49
+ root README contains the complete workbook-to-ODCS-to-dbt walkthrough,
50
+ architecture, compatibility matrix, testing definitions, and deployment guide.
@@ -0,0 +1,122 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "dbt-data-engineering-toolkit-compiler"
7
+ version = "3.0.1"
8
+ description = "Compile BA-authored Excel data products into ODCS and readable dbt projects."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11,<3.15"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ keywords = ["dbt", "data-contract", "data-engineering", "odcs", "sql"]
14
+ classifiers = [
15
+ "Development Status :: 5 - Production/Stable",
16
+ "Environment :: Console",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Topic :: Database",
22
+ "Typing :: Typed",
23
+ ]
24
+ dependencies = [
25
+ "datacontract-cli[excel]>=1.1.3,<2",
26
+ "dbt-core>=1.10.6,<2",
27
+ "dbt-duckdb>=1.10,<2",
28
+ "duckdb>=1.4,<1.5",
29
+ "openpyxl>=3.1,<4",
30
+ "pydantic>=2.10,<3",
31
+ "PyYAML>=6,<7",
32
+ "sqlfluff>=3.4,<5",
33
+ "sqlfluff-templater-dbt>=3.4,<5",
34
+ ]
35
+
36
+ [project.optional-dependencies]
37
+ athena = ["dbt-athena-community>=1.10,<2"]
38
+ bigquery = ["dbt-bigquery>=1.10,<2"]
39
+ clickhouse = ["dbt-clickhouse>=1.10,<2"]
40
+ databricks = ["dbt-databricks>=1.10,<2"]
41
+ duckdb = ["dbt-duckdb>=1.10,<2", "duckdb>=1.4,<1.5"]
42
+ postgres = ["dbt-postgres>=1.10,<2"]
43
+ redshift = ["dbt-redshift>=1.10,<2"]
44
+ snowflake = ["dbt-snowflake>=1.10,<2"]
45
+ spark = ["dbt-spark[PyHive]>=1.10,<2"]
46
+ test = [
47
+ "pyright>=1.1.390,<2",
48
+ "pytest>=8,<10",
49
+ "pytest-cov>=6,<8",
50
+ "ruff>=0.9,<1",
51
+ ]
52
+ release = ["build>=1.2,<2", "bumpver>=2024.1130"]
53
+
54
+ [project.scripts]
55
+ det = "dbt_data_engineering_toolkit_compiler.exposers.cli:main"
56
+
57
+ [tool.setuptools.packages.find]
58
+ where = ["src"]
59
+
60
+ [tool.setuptools.package-data]
61
+ dbt_data_engineering_toolkit_compiler = ["py.typed", "resources/*.yml", "resources/*.xlsx"]
62
+
63
+ [tool.pytest.ini_options]
64
+ testpaths = ["tests"]
65
+ addopts = "-q --strict-config --strict-markers"
66
+
67
+ [tool.coverage.run]
68
+ source = ["dbt_data_engineering_toolkit_compiler"]
69
+
70
+ [tool.coverage.report]
71
+ fail_under = 80
72
+ show_missing = true
73
+ skip_covered = true
74
+ exclude_also = [
75
+ "if TYPE_CHECKING:",
76
+ "if __name__ == .__main__.:",
77
+ "raise NotImplementedError",
78
+ ]
79
+
80
+ [tool.ruff]
81
+ target-version = "py311"
82
+ line-length = 100
83
+
84
+ [tool.ruff.lint]
85
+ select = ["E4", "E7", "E9", "F", "I", "B"]
86
+
87
+ [tool.pyright]
88
+ include = ["src"]
89
+ pythonVersion = "3.11"
90
+ typeCheckingMode = "basic"
91
+ reportMissingTypeStubs = false
92
+
93
+ [tool.bumpver]
94
+ current_version = "3.0.1"
95
+ version_pattern = "MAJOR.MINOR.PATCH"
96
+ commit_message = "bump version {old_version} -> {new_version}"
97
+ tag_message = "v{new_version}"
98
+ tag_scope = "default"
99
+ pre_commit_hook = ""
100
+ post_commit_hook = ""
101
+ commit = true
102
+ tag = true
103
+ push = true
104
+
105
+ [tool.bumpver.file_patterns]
106
+ "pyproject.toml" = [
107
+ '^version = "{version}"',
108
+ '^current_version = "{version}"',
109
+ ]
110
+ "src/dbt_data_engineering_toolkit_compiler/version.py" = [
111
+ '^COMPILER_VERSION = "{version}"',
112
+ '^WORKBOOK_SCHEMA_VERSION = "{version}"',
113
+ '^DEFAULT_TOOLKIT_REVISION = "v{version}"',
114
+ '^DET_SPEC_VERSION = "det/v{version}"',
115
+ '^OPERATOR_REGISTRY_VERSION = "{version}"',
116
+ ]
117
+ "../dbt/dbt_project.yml" = [
118
+ '^version: {version}$',
119
+ ]
120
+ "../aliases/de_toolkit/dbt_project.yml" = [
121
+ '^version: {version}$',
122
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,5 @@
1
+ """Controlled data-product compiler for dbt_data_engineering_toolkit."""
2
+
3
+ from .version import COMPILER_VERSION
4
+
5
+ __version__ = COMPILER_VERSION
@@ -0,0 +1,3 @@
1
+ from .exposers.cli import main
2
+
3
+ raise SystemExit(main())
@@ -0,0 +1,352 @@
1
+ """Explicit adapter capabilities used by validation and project emission."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass
6
+
7
+ from .operational import JsonValue
8
+
9
+
10
+ def _env(name: str, default: str | None = None, *, integer: bool = False) -> str:
11
+ default_argument = f", '{default}'" if default is not None else ""
12
+ cast = " | int" if integer else ""
13
+ return "{{ env_var('" + name + "'" + default_argument + ")" + cast + " }}"
14
+
15
+
16
+ @dataclass(frozen=True, slots=True)
17
+ class AdapterProvider:
18
+ name: str
19
+ display_name: str
20
+ dbt_dependency: str
21
+ sqlfluff_dialect: str
22
+ logical_types: dict[str, str]
23
+ operational_types: dict[str, str]
24
+ supported_materializations: frozenset[str]
25
+ supports_incremental: bool
26
+ supports_enforced_contracts: bool
27
+ profile_output: dict[str, JsonValue]
28
+
29
+ def data_type(self, logical_type: str, physical_type: str | None) -> str:
30
+ return physical_type or self.logical_types.get(
31
+ logical_type.casefold(), logical_type.casefold()
32
+ )
33
+
34
+ def operational_type(self, field_name: str) -> str:
35
+ return self.operational_types.get(field_name, self.data_type("string", None))
36
+
37
+
38
+ class AdapterRegistry:
39
+ """Single extension point for warehouse-specific compiler behavior."""
40
+
41
+ def __init__(self, providers: list[AdapterProvider]):
42
+ self._providers = {item.name: item for item in providers}
43
+
44
+ @classmethod
45
+ def default(cls) -> "AdapterRegistry":
46
+ common_materializations = frozenset({"view", "table", "ephemeral"})
47
+ portable = {
48
+ "string": "varchar",
49
+ "number": "numeric",
50
+ "numeric": "numeric",
51
+ "integer": "bigint",
52
+ "boolean": "boolean",
53
+ "date": "date",
54
+ "timestamp": "timestamp",
55
+ "time": "time",
56
+ }
57
+ return cls(
58
+ [
59
+ AdapterProvider(
60
+ name="athena",
61
+ display_name="Amazon Athena",
62
+ dbt_dependency="dbt-athena-community>=1.10,<2",
63
+ sqlfluff_dialect="athena",
64
+ logical_types={
65
+ **portable,
66
+ "string": "varchar",
67
+ "number": "double",
68
+ "numeric": "decimal(38,6)",
69
+ "timestamp": "timestamp",
70
+ },
71
+ operational_types={
72
+ "_det_rejections": "array(varchar)",
73
+ "_det_warnings": "array(varchar)",
74
+ "_det_loaded_at": "timestamp",
75
+ "_det_invocation_id": "varchar",
76
+ "_det_source_system": "varchar",
77
+ },
78
+ supported_materializations=common_materializations,
79
+ supports_incremental=False,
80
+ supports_enforced_contracts=False,
81
+ profile_output={
82
+ "type": "athena",
83
+ "database": _env("DET_ATHENA_DATABASE", "awsdatacatalog"),
84
+ "schema": "__TARGET_SCHEMA__",
85
+ "s3_staging_dir": _env("DET_ATHENA_S3_STAGING_DIR"),
86
+ "region_name": _env("DET_ATHENA_REGION", "us-east-1"),
87
+ "work_group": _env("DET_ATHENA_WORK_GROUP", "primary"),
88
+ "threads": 4,
89
+ },
90
+ ),
91
+ AdapterProvider(
92
+ name="bigquery",
93
+ display_name="Google BigQuery",
94
+ dbt_dependency="dbt-bigquery>=1.10,<2",
95
+ sqlfluff_dialect="bigquery",
96
+ logical_types={
97
+ **portable,
98
+ "string": "string",
99
+ "number": "float64",
100
+ "numeric": "numeric",
101
+ "integer": "int64",
102
+ "boolean": "bool",
103
+ },
104
+ operational_types={
105
+ "_det_rejections": "array<string>",
106
+ "_det_warnings": "array<string>",
107
+ "_det_loaded_at": "timestamp",
108
+ "_det_invocation_id": "string",
109
+ "_det_source_system": "string",
110
+ },
111
+ supported_materializations=common_materializations,
112
+ supports_incremental=False,
113
+ supports_enforced_contracts=True,
114
+ profile_output={
115
+ "type": "bigquery",
116
+ "method": "oauth",
117
+ "project": _env("DET_BIGQUERY_PROJECT"),
118
+ "dataset": "__TARGET_SCHEMA__",
119
+ "location": _env("DET_BIGQUERY_LOCATION", "US"),
120
+ "threads": 4,
121
+ },
122
+ ),
123
+ AdapterProvider(
124
+ name="clickhouse",
125
+ display_name="ClickHouse",
126
+ dbt_dependency="dbt-clickhouse>=1.10,<2",
127
+ sqlfluff_dialect="clickhouse",
128
+ logical_types={
129
+ **portable,
130
+ "string": "String",
131
+ "number": "Float64",
132
+ "numeric": "Decimal(38,6)",
133
+ "integer": "Int64",
134
+ "boolean": "Bool",
135
+ "date": "Date",
136
+ "timestamp": "DateTime64(6)",
137
+ "time": "String",
138
+ },
139
+ operational_types={
140
+ "_det_rejections": "Array(String)",
141
+ "_det_warnings": "Array(String)",
142
+ "_det_loaded_at": "DateTime64(6)",
143
+ "_det_invocation_id": "String",
144
+ "_det_source_system": "String",
145
+ },
146
+ supported_materializations=common_materializations,
147
+ supports_incremental=False,
148
+ supports_enforced_contracts=False,
149
+ profile_output={
150
+ "type": "clickhouse",
151
+ "host": _env("DET_CLICKHOUSE_HOST"),
152
+ "port": _env("DET_CLICKHOUSE_PORT", "8443", integer=True),
153
+ "user": _env("DET_CLICKHOUSE_USER", "default"),
154
+ "password": _env("DBT_ENV_SECRET_DET_CLICKHOUSE_PASSWORD", ""),
155
+ "schema": "__TARGET_SCHEMA__",
156
+ "secure": True,
157
+ "verify": True,
158
+ "threads": 4,
159
+ },
160
+ ),
161
+ AdapterProvider(
162
+ name="databricks",
163
+ display_name="Databricks",
164
+ dbt_dependency="dbt-databricks>=1.10,<2",
165
+ sqlfluff_dialect="databricks",
166
+ logical_types={
167
+ **portable,
168
+ "string": "string",
169
+ "number": "double",
170
+ "numeric": "decimal(38,6)",
171
+ "time": "string",
172
+ },
173
+ operational_types={
174
+ "_det_rejections": "array<string>",
175
+ "_det_warnings": "array<string>",
176
+ "_det_loaded_at": "timestamp",
177
+ "_det_invocation_id": "string",
178
+ "_det_source_system": "string",
179
+ },
180
+ supported_materializations=common_materializations,
181
+ supports_incremental=False,
182
+ supports_enforced_contracts=True,
183
+ profile_output={
184
+ "type": "databricks",
185
+ "host": _env("DET_DATABRICKS_HOST"),
186
+ "http_path": _env("DET_DATABRICKS_HTTP_PATH"),
187
+ "token": _env("DBT_ENV_SECRET_DET_DATABRICKS_TOKEN"),
188
+ "catalog": _env("DET_DATABRICKS_CATALOG", "hive_metastore"),
189
+ "schema": "__TARGET_SCHEMA__",
190
+ "threads": 4,
191
+ },
192
+ ),
193
+ AdapterProvider(
194
+ name="duckdb",
195
+ display_name="DuckDB",
196
+ dbt_dependency="dbt-duckdb>=1.10,<2",
197
+ sqlfluff_dialect="duckdb",
198
+ logical_types={
199
+ **portable,
200
+ "string": "varchar",
201
+ "number": "double",
202
+ "numeric": "decimal(38,6)",
203
+ },
204
+ operational_types={
205
+ "_det_rejections": "varchar[]",
206
+ "_det_warnings": "varchar[]",
207
+ "_det_loaded_at": "timestamp with time zone",
208
+ "_det_invocation_id": "varchar",
209
+ "_det_source_system": "varchar",
210
+ },
211
+ supported_materializations=common_materializations,
212
+ supports_incremental=False,
213
+ supports_enforced_contracts=True,
214
+ profile_output={
215
+ "type": "duckdb",
216
+ "path": "target/data_product.duckdb",
217
+ "schema": "__TARGET_SCHEMA__",
218
+ "threads": 4,
219
+ },
220
+ ),
221
+ AdapterProvider(
222
+ name="postgres",
223
+ display_name="Postgres",
224
+ dbt_dependency="dbt-postgres>=1.10,<2",
225
+ sqlfluff_dialect="postgres",
226
+ logical_types={**portable, "string": "text"},
227
+ operational_types={
228
+ "_det_rejections": "text[]",
229
+ "_det_warnings": "text[]",
230
+ "_det_loaded_at": "timestamp with time zone",
231
+ "_det_invocation_id": "text",
232
+ "_det_source_system": "text",
233
+ },
234
+ supported_materializations=common_materializations,
235
+ supports_incremental=False,
236
+ supports_enforced_contracts=True,
237
+ profile_output={
238
+ "type": "postgres",
239
+ "host": _env("DET_POSTGRES_HOST"),
240
+ "port": _env("DET_POSTGRES_PORT", "5432", integer=True),
241
+ "user": _env("DET_POSTGRES_USER"),
242
+ "password": _env("DET_POSTGRES_PASSWORD"),
243
+ "dbname": _env("DET_POSTGRES_DATABASE"),
244
+ "schema": "__TARGET_SCHEMA__",
245
+ "threads": 4,
246
+ },
247
+ ),
248
+ AdapterProvider(
249
+ name="redshift",
250
+ display_name="Amazon Redshift",
251
+ dbt_dependency="dbt-redshift>=1.10,<2",
252
+ sqlfluff_dialect="redshift",
253
+ logical_types={
254
+ **portable,
255
+ "string": "varchar",
256
+ "number": "double precision",
257
+ "numeric": "decimal(38,6)",
258
+ },
259
+ operational_types={
260
+ "_det_rejections": "super",
261
+ "_det_warnings": "super",
262
+ "_det_loaded_at": "timestamp",
263
+ "_det_invocation_id": "varchar",
264
+ "_det_source_system": "varchar",
265
+ },
266
+ supported_materializations=common_materializations,
267
+ supports_incremental=False,
268
+ supports_enforced_contracts=True,
269
+ profile_output={
270
+ "type": "redshift",
271
+ "host": _env("DET_REDSHIFT_HOST"),
272
+ "port": _env("DET_REDSHIFT_PORT", "5439", integer=True),
273
+ "user": _env("DET_REDSHIFT_USER"),
274
+ "password": _env("DBT_ENV_SECRET_DET_REDSHIFT_PASSWORD"),
275
+ "dbname": _env("DET_REDSHIFT_DATABASE"),
276
+ "schema": "__TARGET_SCHEMA__",
277
+ "threads": 4,
278
+ },
279
+ ),
280
+ AdapterProvider(
281
+ name="snowflake",
282
+ display_name="Snowflake",
283
+ dbt_dependency="dbt-snowflake>=1.10,<2",
284
+ sqlfluff_dialect="snowflake",
285
+ logical_types={
286
+ **portable,
287
+ "string": "varchar",
288
+ "integer": "number(38,0)",
289
+ "timestamp": "timestamp_tz",
290
+ },
291
+ operational_types={
292
+ "_det_rejections": "array",
293
+ "_det_warnings": "array",
294
+ "_det_loaded_at": "timestamp_tz",
295
+ "_det_invocation_id": "varchar",
296
+ "_det_source_system": "varchar",
297
+ },
298
+ supported_materializations=common_materializations,
299
+ supports_incremental=False,
300
+ supports_enforced_contracts=True,
301
+ profile_output={
302
+ "type": "snowflake",
303
+ "account": _env("DET_SNOWFLAKE_ACCOUNT"),
304
+ "user": _env("DET_SNOWFLAKE_USER"),
305
+ "password": _env("DBT_ENV_SECRET_DET_SNOWFLAKE_PASSWORD"),
306
+ "role": _env("DET_SNOWFLAKE_ROLE"),
307
+ "database": _env("DET_SNOWFLAKE_DATABASE"),
308
+ "warehouse": _env("DET_SNOWFLAKE_WAREHOUSE"),
309
+ "schema": "__TARGET_SCHEMA__",
310
+ "threads": 4,
311
+ },
312
+ ),
313
+ AdapterProvider(
314
+ name="spark",
315
+ display_name="Apache Spark",
316
+ dbt_dependency="dbt-spark[PyHive]>=1.10,<2",
317
+ sqlfluff_dialect="sparksql",
318
+ logical_types={
319
+ **portable,
320
+ "string": "string",
321
+ "number": "double",
322
+ "numeric": "decimal(38,6)",
323
+ "time": "string",
324
+ },
325
+ operational_types={
326
+ "_det_rejections": "array<string>",
327
+ "_det_warnings": "array<string>",
328
+ "_det_loaded_at": "timestamp",
329
+ "_det_invocation_id": "string",
330
+ "_det_source_system": "string",
331
+ },
332
+ supported_materializations=common_materializations,
333
+ supports_incremental=False,
334
+ supports_enforced_contracts=False,
335
+ profile_output={
336
+ "type": "spark",
337
+ "method": "thrift",
338
+ "host": _env("DET_SPARK_HOST"),
339
+ "port": _env("DET_SPARK_PORT", "10001", integer=True),
340
+ "user": _env("DET_SPARK_USER", "dbt"),
341
+ "schema": "__TARGET_SCHEMA__",
342
+ "threads": 4,
343
+ },
344
+ ),
345
+ ]
346
+ )
347
+
348
+ def get(self, name: str) -> AdapterProvider | None:
349
+ return self._providers.get(name.casefold())
350
+
351
+ def names(self) -> tuple[str, ...]:
352
+ return tuple(sorted(self._providers))