From ec7401da2d6f1a8125832a883d5ce90771f3aead Mon Sep 17 00:00:00 2001 From: Pulkit Gaur Date: Fri, 31 May 2024 15:05:53 +0530 Subject: [PATCH] fix tests --- src/datapilot/core/platforms/dbt/factory.py | 4 ++++ src/datapilot/core/platforms/dbt/schemas/manifest.py | 11 ++++------- .../platforms/dbt/wrappers/manifest/v10/wrapper.py | 3 ++- .../platforms/dbt/wrappers/manifest/v12/wrapper.py | 3 ++- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/datapilot/core/platforms/dbt/factory.py b/src/datapilot/core/platforms/dbt/factory.py index ee0235ad..d021f4ac 100644 --- a/src/datapilot/core/platforms/dbt/factory.py +++ b/src/datapilot/core/platforms/dbt/factory.py @@ -1,18 +1,22 @@ from dbt_artifacts_parser.parsers.catalog.catalog_v1 import CatalogV1 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 datapilot.core.platforms.dbt.schemas.manifest import Catalog from datapilot.core.platforms.dbt.schemas.manifest import Manifest from datapilot.core.platforms.dbt.wrappers.catalog.v1.wrapper import CatalogV1Wrapper from datapilot.core.platforms.dbt.wrappers.manifest.v10.wrapper import ManifestV10Wrapper from datapilot.core.platforms.dbt.wrappers.manifest.v11.wrapper import ManifestV11Wrapper +from datapilot.core.platforms.dbt.wrappers.manifest.v12.wrapper import ManifestV12Wrapper from datapilot.exceptions.exceptions import AltimateNotSupportedError class DBTFactory: @classmethod def get_manifest_wrapper(cls, manifest: Manifest): + if isinstance(manifest, ManifestV12): + return ManifestV12Wrapper(manifest) if isinstance(manifest, ManifestV11): return ManifestV11Wrapper(manifest) if isinstance(manifest, ManifestV10): diff --git a/src/datapilot/core/platforms/dbt/schemas/manifest.py b/src/datapilot/core/platforms/dbt/schemas/manifest.py index 125b7d42..1b5fc9cb 100644 --- a/src/datapilot/core/platforms/dbt/schemas/manifest.py +++ b/src/datapilot/core/platforms/dbt/schemas/manifest.py @@ -47,16 +47,13 @@ class DBTVersion(BaseModel): class AltimateDocs(BaseModel): - class Config: - extra = Extra.forbid - show: Optional[bool] = True - node_color: Optional[Optional[str]] = None + node_color: Optional[str] = None class AltimateDependsOn(BaseModel): - nodes: Optional[List[str]] - macros: Optional[List[str]] + nodes: Optional[List[str]] = None + macros: Optional[List[str]] = None class AltimateManifestColumnInfo(BaseModel): @@ -165,7 +162,7 @@ class AltimateManifestNode(BaseModel): compiled_path: Optional[Optional[str]] = None compiled: Optional[bool] = False compiled_code: Optional[Optional[str]] = None - access: Optional[AltimateAccess] + access: Optional[AltimateAccess] = "protected" contract: Optional[AltimateDBTContract] = None meta: Optional[Dict[str, Any]] = None patch_path: Optional[Optional[str]] = None diff --git a/src/datapilot/core/platforms/dbt/wrappers/manifest/v10/wrapper.py b/src/datapilot/core/platforms/dbt/wrappers/manifest/v10/wrapper.py index bc74152a..57398f25 100644 --- a/src/datapilot/core/platforms/dbt/wrappers/manifest/v10/wrapper.py +++ b/src/datapilot/core/platforms/dbt/wrappers/manifest/v10/wrapper.py @@ -11,6 +11,7 @@ from datapilot.core.platforms.dbt.constants import SINGULAR from datapilot.core.platforms.dbt.schemas.manifest import AltimateDBTContract from datapilot.core.platforms.dbt.schemas.manifest import AltimateDependsOn +from datapilot.core.platforms.dbt.schemas.manifest import AltimateDocs from datapilot.core.platforms.dbt.schemas.manifest import AltimateExposureType from datapilot.core.platforms.dbt.schemas.manifest import AltimateExternalTable from datapilot.core.platforms.dbt.schemas.manifest import AltimateFileHash @@ -175,7 +176,7 @@ def _get_macro(self, macro: MacroNode) -> AltimateManifestMacroNode: ), description=macro.description, meta=macro.meta, - docs=macro.docs, + docs=AltimateDocs(show=macro.docs.show, node_color=macro.docs.node_color) if macro.docs else None, patch_path=macro.patch_path, arguments=[AltimateMacroArgument(**arg.dict()) for arg in macro.arguments] if macro.arguments else None, created_at=macro.created_at, diff --git a/src/datapilot/core/platforms/dbt/wrappers/manifest/v12/wrapper.py b/src/datapilot/core/platforms/dbt/wrappers/manifest/v12/wrapper.py index 06f41620..887be79d 100644 --- a/src/datapilot/core/platforms/dbt/wrappers/manifest/v12/wrapper.py +++ b/src/datapilot/core/platforms/dbt/wrappers/manifest/v12/wrapper.py @@ -11,6 +11,7 @@ from datapilot.core.platforms.dbt.constants import SINGULAR from datapilot.core.platforms.dbt.schemas.manifest import AltimateDBTContract from datapilot.core.platforms.dbt.schemas.manifest import AltimateDependsOn +from datapilot.core.platforms.dbt.schemas.manifest import AltimateDocs from datapilot.core.platforms.dbt.schemas.manifest import AltimateExposureType from datapilot.core.platforms.dbt.schemas.manifest import AltimateExternalTable from datapilot.core.platforms.dbt.schemas.manifest import AltimateFileHash @@ -175,7 +176,7 @@ def _get_macro(self, macro: MacroNode) -> AltimateManifestMacroNode: ), description=macro.description, meta=macro.meta, - docs=macro.docs, + docs=AltimateDocs(show=macro.docs.show, node_color=macro.docs.node_color) if macro.docs else None, patch_path=macro.patch_path, arguments=[AltimateMacroArgument(**arg.dict()) for arg in macro.arguments] if macro.arguments else None, created_at=macro.created_at,