Skip to content

Commit d114bd4

Browse files
authored
Update Fusion compatibility output (#268)
* allow dbt_artifacts versions 2.10+
1 parent a29e436 commit d114bd4

File tree

10 files changed

+218
-351
lines changed

10 files changed

+218
-351
lines changed

packages/dbt_fusion_package_tools/pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ dependencies = [
88
"mashumaro>=3.17",
99
"pyyaml>=6.0.2",
1010
"dbt-protos>=1.0.410",
11+
"requests>=2.32.5",
12+
"rich>=14.0.0",
1113
]
1214

1315
dynamic = ["version"]

packages/dbt_fusion_package_tools/src/dbt_fusion_package_tools/fusion_version_compatibility_output.py

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,10 +1101,10 @@
11011101
"latest_version_incl_prerelease": "=0.5.3",
11021102
},
11031103
"bqbooster/dbt_bigquery_monitoring": {
1104-
"latest_version": "=0.23.1",
1105-
"oldest_fusion_compatible_version": None,
1106-
"latest_fusion_compatible_version": None,
1107-
"fusion_compatible_versions": [],
1104+
"latest_version": "=0.24.0",
1105+
"oldest_fusion_compatible_version": "=0.24.0",
1106+
"latest_fusion_compatible_version": "=0.24.0",
1107+
"fusion_compatible_versions": ["=0.24.0"],
11081108
"fusion_incompatible_versions": [
11091109
"=0.4.0",
11101110
"=0.5.0",
@@ -1158,16 +1158,17 @@
11581158
"=0.9.1",
11591159
],
11601160
"unknown_compatibility_versions": ["=0.1.0", "=0.2.0", "=0.3.0"],
1161-
"package_latest_version_index_json": "=0.23.1",
1161+
"package_latest_version_index_json": "=0.24.0",
11621162
"package_redirect_name": None,
11631163
"package_redirect_namespace": None,
1164-
"latest_version_incl_prerelease": "=0.23.1",
1164+
"latest_version_incl_prerelease": "=0.24.0",
11651165
},
11661166
"brooklyn-data/dbt_artifacts": {
11671167
"latest_version": "=2.10.0",
1168-
"oldest_fusion_compatible_version": "=0.2.0",
1168+
"oldest_fusion_compatible_version": "=2.10.0",
11691169
"latest_fusion_compatible_version": "=2.10.0",
1170-
"fusion_compatible_versions": [
1170+
"fusion_compatible_versions": ["=2.10.0"],
1171+
"fusion_incompatible_versions": [
11711172
"=0.2.0",
11721173
"=0.2.1",
11731174
"=0.3.0",
@@ -1188,14 +1189,11 @@
11881189
"=2.0.0",
11891190
"=2.1.0",
11901191
"=2.1.1",
1191-
"=2.10.0",
11921192
"=2.2.0",
11931193
"=2.2.1",
11941194
"=2.2.2",
11951195
"=2.2.3",
11961196
"=2.3.0",
1197-
],
1198-
"fusion_incompatible_versions": [
11991197
"=2.4.0",
12001198
"=2.4.1",
12011199
"=2.4.2",
@@ -2224,7 +2222,7 @@
22242222
"latest_version_incl_prerelease": "=0.1.0",
22252223
},
22262224
"edanalytics/edu_edfi_source": {
2227-
"latest_version": "=0.5.3",
2225+
"latest_version": "=0.6.0",
22282226
"oldest_fusion_compatible_version": None,
22292227
"latest_fusion_compatible_version": None,
22302228
"fusion_compatible_versions": [],
@@ -2267,15 +2265,16 @@
22672265
"=0.5.1",
22682266
"=0.5.2",
22692267
"=0.5.3",
2268+
"=0.6.0",
22702269
],
22712270
"unknown_compatibility_versions": ["=0.1.0", "=0.1.1", "=0.1.2", "=0.1.3", "=0.2.0", "=0.1.0"],
2272-
"package_latest_version_index_json": "=0.5.3",
2271+
"package_latest_version_index_json": "=0.6.0",
22732272
"package_redirect_name": None,
22742273
"package_redirect_namespace": None,
2275-
"latest_version_incl_prerelease": "=0.5.3",
2274+
"latest_version_incl_prerelease": "=0.6.0",
22762275
},
22772276
"edanalytics/edu_wh": {
2278-
"latest_version": "=0.5.3",
2277+
"latest_version": "=0.6.0",
22792278
"oldest_fusion_compatible_version": None,
22802279
"latest_fusion_compatible_version": None,
22812280
"fusion_compatible_versions": [],
@@ -2304,12 +2303,13 @@
23042303
"=0.5.1",
23052304
"=0.5.2",
23062305
"=0.5.3",
2306+
"=0.6.0",
23072307
],
23082308
"unknown_compatibility_versions": ["=0.1.0", "=0.1.1-rc2", "=0.1.1", "=0.1.2", "=0.1.3", "=0.1.4", "=0.2.0"],
2309-
"package_latest_version_index_json": "=0.5.3",
2309+
"package_latest_version_index_json": "=0.6.0",
23102310
"package_redirect_name": None,
23112311
"package_redirect_namespace": None,
2312-
"latest_version_incl_prerelease": "=0.5.3",
2312+
"latest_version_incl_prerelease": "=0.6.0",
23132313
},
23142314
"elementary-data/elementary": {
23152315
"latest_version": "=0.21.0",
@@ -8672,9 +8672,10 @@
86728672
},
86738673
"tailsdotcom/dbt_artifacts": {
86748674
"latest_version": "=2.10.0",
8675-
"oldest_fusion_compatible_version": "=0.2.0",
8675+
"oldest_fusion_compatible_version": "=2.10.0",
86768676
"latest_fusion_compatible_version": "=2.10.0",
8677-
"fusion_compatible_versions": [
8677+
"fusion_compatible_versions": ["=2.10.0"],
8678+
"fusion_incompatible_versions": [
86788679
"=0.2.0",
86798680
"=0.2.1",
86808681
"=0.3.0",
@@ -8695,14 +8696,11 @@
86958696
"=2.0.0",
86968697
"=2.1.0",
86978698
"=2.1.1",
8698-
"=2.10.0",
86998699
"=2.2.0",
87008700
"=2.2.1",
87018701
"=2.2.2",
87028702
"=2.2.3",
87038703
"=2.3.0",
8704-
],
8705-
"fusion_incompatible_versions": [
87068704
"=2.4.0",
87078705
"=2.4.1",
87088706
"=2.4.2",

packages/dbt_fusion_package_tools/src/dbt_fusion_package_tools/manual_overrides.py

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
EXPLICIT_DISALLOW_ALL_VERSIONS: set[str] = set(
22
[
3-
"brooklyn-data/dbt_artifacts",
43
"Snowflake-Labs/dbt_constraints",
54
"get-select/dbt_snowflake_query_tags",
65
"data-mie/dbt_profiler",
@@ -55,5 +54,51 @@
5554
# dbt_project_evaluator version 1.1.0 has compatible
5655
# require dbt version but actually has bug that makes
5756
# package incompatible until fixed in 1.1.2
58-
"dbt-labs/dbt_project_evaluator": set(["1.1.0", "1.1.1"])
57+
"dbt-labs/dbt_project_evaluator": set(["1.1.0", "1.1.1"]),
58+
"brooklyn-data/dbt_artifacts": set(
59+
[
60+
"0.1.0",
61+
"0.2.0",
62+
"0.2.1",
63+
"0.3.0",
64+
"0.4.0",
65+
"0.4.1",
66+
"0.4.2",
67+
"0.4.3",
68+
"0.4.4",
69+
"0.5.0",
70+
"0.6.0",
71+
"0.7.0",
72+
"0.8.0",
73+
"1.0.0",
74+
"1.1.0",
75+
"1.1.1",
76+
"1.1.2",
77+
"1.2.0",
78+
"2.0.0",
79+
"2.1.0",
80+
"2.1.1",
81+
"2.2.0",
82+
"2.2.1",
83+
"2.2.2",
84+
"2.2.3",
85+
"2.3.0",
86+
"2.4.0",
87+
"2.4.1",
88+
"2.4.2",
89+
"2.4.3",
90+
"2.5.0",
91+
"2.6.0",
92+
"2.6.1",
93+
"2.6.2",
94+
"2.6.3",
95+
"2.6.4",
96+
"2.7.0",
97+
"2.8.0",
98+
"2.9.0",
99+
"2.9.1",
100+
"2.9.2",
101+
"2.9.3",
102+
]
103+
),
59104
}

packages/dbt_fusion_package_tools/src/dbt_fusion_package_tools/scripts/get_package_hub_files.py

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,78 @@ def download_package_jsons_from_hub_repo(
197197
return packages
198198

199199

200+
def read_json_from_local_hub_repo(path: str, file_count_limit: int = 0):
201+
"""Read JSON files from a local copy of the hub repo and return a
202+
defaultdict mapping package_id -> list[parsed outputs].
203+
204+
The `path` argument may be either:
205+
- the repository root (so files are found under `data/packages/...`),
206+
- or the `data/packages` directory itself, or
207+
- a single JSON file path.
208+
209+
Behavior mirrors `download_package_jsons_from_hub_repo` where possible:
210+
- JSON files are found recursively
211+
- each file is parsed and passed to `process_json(file_path, parsed_json)`
212+
- parsing/IO errors are warned and skipped
213+
"""
214+
base = Path(path)
215+
packages: defaultdict[str, list[dict[str, Any]]] = defaultdict(list)
216+
217+
if not base.exists():
218+
warnings.warn(f"Path does not exist: {path}")
219+
return packages
220+
221+
# Collect JSON files
222+
json_files: List[Path]
223+
if base.is_file():
224+
if base.suffix.lower() == ".json":
225+
json_files = [base]
226+
else:
227+
return packages
228+
else:
229+
json_files = sorted(base.rglob("*.json"), key=lambda p: str(p))
230+
231+
if file_count_limit > 0:
232+
json_files = json_files[:file_count_limit]
233+
234+
if not json_files:
235+
return packages
236+
237+
for file in json_files:
238+
try:
239+
with file.open("r", encoding="utf-8") as fh:
240+
parsed = json.load(fh)
241+
242+
# Try to produce a repo-style path like 'data/packages/...'
243+
file_path: str
244+
parts = list(file.parts)
245+
if "data" in parts:
246+
idx = parts.index("data")
247+
file_path = Path(*parts[idx:]).as_posix()
248+
else:
249+
try:
250+
# prefer path relative to provided base
251+
rel = file.relative_to(base)
252+
file_path = rel.as_posix()
253+
except Exception:
254+
file_path = file.as_posix()
255+
256+
# If the user passed the `data/packages` directory itself,
257+
# ensure returned path still starts with 'data/packages'
258+
if not file_path.startswith("data/packages") and base.name == "packages" and base.parent.name == "data":
259+
rel = file.relative_to(base)
260+
file_path = Path("data") / "packages" / rel
261+
file_path = file_path.as_posix()
262+
263+
output = process_json(file_path, parsed)
264+
if output != {}:
265+
packages[output["package_id_from_path"]].append(output)
266+
except Exception as exc:
267+
warnings.warn(f"Failed to read/parse {file}: {exc}")
268+
269+
return packages
270+
271+
200272
def reload_packages_from_file(
201273
file_path: Path,
202274
) -> defaultdict[str, list[dict[str, Any]]]:
@@ -206,7 +278,8 @@ def reload_packages_from_file(
206278

207279
def main():
208280
file_count_limit = 0
209-
results = download_package_jsons_from_hub_repo(file_count_limit=file_count_limit)
281+
# results = download_package_jsons_from_hub_repo(file_count_limit=file_count_limit)
282+
results = read_json_from_local_hub_repo(path="~/workplace/hub.getdbt.com", file_count_limit=file_count_limit)
210283
print(f"Downloaded {len(results)} packages from hub.getdbt.com")
211284
output_path: Path = Path.cwd() / "src" / "dbt_fusion_package_tools" / "scripts" / "output"
212285
write_dict_to_json(results, output_path)

packages/dbt_fusion_package_tools/src/dbt_fusion_package_tools/version_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def to_version_string(self, skip_matcher: bool = False) -> str:
8181
build = "+" + self.build
8282

8383
if not skip_matcher:
84-
matcher = self.matcher
84+
matcher = self.matcher.value
8585
return "{}{}.{}.{}{}{}".format(matcher, self.major, self.minor, self.patch, prerelease, build)
8686

8787
@classmethod
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: "dbt_artifacts"
2+
version: "2.9.3"
3+
config-version: 2
4+
require-dbt-version: [">=1.3.0", "<1.11.0"]
5+
profile: "dbt_artifacts"
6+
7+
clean-targets: # folders to be removed by `dbt clean`
8+
- "target"
9+
- "dbt_packages"
10+
- "logs"
11+
12+
models:
13+
dbt_artifacts:
14+
+materialized: view
15+
+file_format: '{{ "delta" if target.name == "databricks" else "" }}'
16+
sources:
17+
+materialized: incremental
18+
+full_refresh: false
19+
+persist_docs:
20+
# Databricks and SQL Server don't offer column-level support for persisting docs
21+
columns: '{{ target.name != "databricks" and target.type != "sqlserver" }}'
22+
relation: '{{ target.type != "sqlserver" }}'
23+
+as_columnstore: False

tests/integration_tests/package_upgrades/mixed_versions/packages.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ packages:
2828
version: "1.1.0"
2929
# version is incompatible, but compatible version has different name
3030
- package: calogica/dbt_date
31-
version: 0.10.1
31+
version: 0.10.1
32+
# version 2.9.3 has manual override as incompatible, 2.10.0 is compatible
33+
- package: brooklyn-data/dbt_artifacts
34+
version: 2.9.3

tests/unit_tests/package_upgrades/test_fusion_compatible_versions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ def test_check_renames(old_package_id, new_package_id):
3535
("dbt-labs/dbt_project_evaluator", "=1.1.0", False),
3636
("dbt-labs/dbt_project_evaluator", "=1.1.1", False),
3737
("dbt-labs/dbt_project_evaluator", "=1.1.2", True),
38+
("brooklyn-data/dbt_artifacts", "=2.10.0", True),
39+
("brooklyn-data/dbt_artifacts", "=2.9.3", False),
40+
("brooklyn-data/dbt_artifacts", "=0.6.0", False),
3841
],
3942
)
4043
def test_check_explicit_override_version(package_id, version, expected):

tests/unit_tests/package_upgrades/test_package_upgrade.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
PROJECT_WITH_PACKAGES_PATH = Path("tests/integration_tests/package_upgrades/mixed_versions")
1818
# update if count changes
19-
PROJECT_DEPENDENCY_COUNT = 9
19+
PROJECT_DEPENDENCY_COUNT = 10
2020

2121
# cases to test:
2222

@@ -90,6 +90,9 @@ def test_generate_package_dependencies():
9090
elif package == "calogica/dbt_date":
9191
assert fusion_compatibility_state == PackageVersionFusionCompatibilityState.EXPLICIT_ALLOW
9292
assert package_fusion_compatibility_state == PackageFusionCompatibilityState.ALL_VERSIONS_COMPATIBLE
93+
elif package == "brooklyn-data/dbt_artifacts":
94+
assert fusion_compatibility_state == PackageVersionFusionCompatibilityState.EXPLICIT_DISALLOW
95+
assert package_fusion_compatibility_state == PackageFusionCompatibilityState.SOME_VERSIONS_COMPATIBLE
9396

9497

9598
def test_check_for_package_upgrades():
@@ -125,6 +128,11 @@ def test_check_for_package_upgrades():
125128
)
126129
elif package == "calogica/dbt_date":
127130
assert fusion_compatibility_state == PackageVersionUpgradeType.NO_UPGRADE_REQUIRED
131+
elif package == "brooklyn-data/dbt_artifacts":
132+
assert (
133+
fusion_compatibility_state
134+
== PackageVersionUpgradeType.PUBLIC_PACKAGE_FUSION_COMPATIBLE_VERSION_EXCEEDS_PROJECT_CONFIG
135+
)
128136

129137

130138
def test_upgrade_package_versions_no_force_update():
@@ -138,7 +146,7 @@ def test_upgrade_package_versions_no_force_update():
138146
assert output
139147
assert output.upgraded
140148
assert len(output.upgrades) == 1
141-
assert len(output.unchanged) == 8
149+
assert len(output.unchanged) == 9
142150
assert len(output.upgrades) + len(output.unchanged) == PROJECT_DEPENDENCY_COUNT
143151
output.print_to_console(json_output=False)
144152
output.print_to_console(json_output=True)
@@ -154,7 +162,7 @@ def test_upgrade_package_versions_with_force_update():
154162
)
155163
assert output
156164
assert output.upgraded
157-
assert len(output.upgrades) == 3
165+
assert len(output.upgrades) == 4
158166
assert len(output.unchanged) == 6
159167
assert len(output.upgrades) + len(output.unchanged) == PROJECT_DEPENDENCY_COUNT
160168
output.print_to_console(json_output=False)

0 commit comments

Comments
 (0)