Skip to content

Commit

Permalink
Support dbt 1.8 (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-iskw committed May 21, 2024
1 parent 2171854 commit 84f06fe
Show file tree
Hide file tree
Showing 11 changed files with 27,487 additions and 48 deletions.
25 changes: 24 additions & 1 deletion dbt_artifacts_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
from dbt_artifacts_parser.parsers.manifest.manifest_v9 import ManifestV9
from dbt_artifacts_parser.parsers.manifest.manifest_v10 import ManifestV10
from dbt_artifacts_parser.parsers.manifest.manifest_v11 import ManifestV11
from dbt_artifacts_parser.parsers.manifest.manifest_v12 import ManifestV12
from dbt_artifacts_parser.parsers.run_results.run_results_v1 import RunResultsV1
from dbt_artifacts_parser.parsers.run_results.run_results_v2 import RunResultsV2
from dbt_artifacts_parser.parsers.run_results.run_results_v3 import RunResultsV3
from dbt_artifacts_parser.parsers.run_results.run_results_v4 import RunResultsV4
from dbt_artifacts_parser.parsers.run_results.run_results_v5 import RunResultsV5
from dbt_artifacts_parser.parsers.run_results.run_results_v6 import RunResultsV6
from dbt_artifacts_parser.parsers.sources.sources_v1 import SourcesV1
from dbt_artifacts_parser.parsers.sources.sources_v2 import SourcesV2
from dbt_artifacts_parser.parsers.sources.sources_v3 import SourcesV3
Expand Down Expand Up @@ -82,6 +84,8 @@ def parse_manifest(
ManifestV8,
ManifestV9,
ManifestV10,
ManifestV11,
ManifestV12,
]:
"""Parse manifest.json
Expand Down Expand Up @@ -114,6 +118,8 @@ def parse_manifest(
return ManifestV10(**manifest)
elif dbt_schema_version == ArtifactTypes.MANIFEST_V11.value.dbt_schema_version:
return ManifestV11(**manifest)
elif dbt_schema_version == ArtifactTypes.MANIFEST_V12.value.dbt_schema_version:
return ManifestV12(**manifest)
raise ValueError("Not a manifest.json")


Expand Down Expand Up @@ -204,13 +210,21 @@ def parse_manifest_v11(manifest: dict) -> ManifestV6:
raise ValueError("Not a manifest.json v11")


def parse_manifest_v12(manifest: dict) -> ManifestV12:
"""Parse manifest.json ver.12"""
dbt_schema_version = get_dbt_schema_version(artifact_json=manifest)
if dbt_schema_version == ArtifactTypes.MANIFEST_V12.value.dbt_schema_version:
return ManifestV12(**manifest)
raise ValueError("Not a manifest.json v12")


#
# run-results
#
def parse_run_results(
run_results: dict,
) -> Union[RunResultsV1, RunResultsV2, RunResultsV3, RunResultsV4,
RunResultsV5]:
RunResultsV5, RunResultsV6]:
"""Parse run-results.json
Args:
Expand All @@ -230,6 +244,8 @@ def parse_run_results(
return RunResultsV4(**run_results)
elif dbt_schema_version == ArtifactTypes.RUN_RESULTS_V5.value.dbt_schema_version:
return RunResultsV5(**run_results)
elif dbt_schema_version == ArtifactTypes.RUN_RESULTS_V6.value.dbt_schema_version:
return RunResultsV6(**run_results)
raise ValueError("Not a manifest.json")


Expand Down Expand Up @@ -272,6 +288,13 @@ def parse_run_results_v5(run_results: dict) -> RunResultsV5:
raise ValueError("Not a run-results.json v5")


def parse_run_results_v6(run_results: dict) -> RunResultsV6:
"""Parse run-results.json v6"""
dbt_schema_version = get_dbt_schema_version(artifact_json=run_results)
if dbt_schema_version == ArtifactTypes.RUN_RESULTS_V6.value.dbt_schema_version:
return RunResultsV6(**run_results)
raise ValueError("Not a run-results.json v6")

#
# sources
#
Expand Down
1 change: 1 addition & 0 deletions dbt_artifacts_parser/parsers/manifest/manifest_v11.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from dbt_artifacts_parser.parsers.base import BaseParserModel


class ResourceType11(Enum):
doc = 'doc'
class Documentation(BaseParserModel):
Expand Down
Loading

0 comments on commit 84f06fe

Please sign in to comment.