Skip to content

Commit

Permalink
Revert "Backport "Fix #8544: Parse the correct schema version from ma…
Browse files Browse the repository at this point in the history
…nifest" (#8587)"

This reverts commit 48ba14c.
  • Loading branch information
emmyoop committed Sep 7, 2023
1 parent e150626 commit 6393380
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 32 deletions.
6 changes: 0 additions & 6 deletions .changes/unreleased/Fixes-20230906-162427.yaml

This file was deleted.

10 changes: 1 addition & 9 deletions core/dbt/contracts/graph/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1510,15 +1510,7 @@ def get_manifest_schema_version(dct: dict) -> int:
schema_version = dct.get("metadata", {}).get("dbt_schema_version", None)
if not schema_version:
raise ValueError("Manifest doesn't have schema version")

# schema_version is in this format: https://schemas.getdbt.com/dbt/manifest/v10.json
# What the code below is doing:
# 1. Split on "/" – v10.json
# 2. Split on "." – v10
# 3. Skip first character – 10
# 4. Convert to int
# TODO: If this gets more complicated, turn into a regex
return int(schema_version.split("/")[-1].split(".")[0][1:])
return int(schema_version.split(".")[-2][-1])


def _check_duplicates(value: BaseNode, src: Mapping[str, BaseNode]):
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/artifacts/data/state/v10/manifest.json

Large diffs are not rendered by default.

19 changes: 3 additions & 16 deletions tests/functional/artifacts/test_previous_version_state.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import json
import pytest
import os
import shutil

import pytest

from dbt.contracts.graph.manifest import WritableManifest, get_manifest_schema_version
from dbt.exceptions import IncompatibleSchemaError
from dbt.tests.util import run_dbt, get_manifest
from dbt.exceptions import IncompatibleSchemaError
from dbt.contracts.graph.manifest import WritableManifest

# This project must have one of each kind of node type, plus disabled versions, for
# test coverage to be complete.
Expand Down Expand Up @@ -354,13 +351,3 @@ def test_nonbackwards_compatible_versions(self, project):
# schema versions 1, 2, 3 are all not forward compatible
for schema_version in range(1, 4):
self.compare_previous_state(project, schema_version, False)

def test_get_manifest_schema_version(self, project):
for schema_version in range(1, self.CURRENT_EXPECTED_MANIFEST_VERSION):
manifest_path = os.path.join(
project.test_data_dir, f"state/v{schema_version}/manifest.json"
)
manifest = json.load(open(manifest_path))

manifest_version = get_manifest_schema_version(manifest)
assert manifest_version == schema_version

0 comments on commit 6393380

Please sign in to comment.