Skip to content

Commit

Permalink
feat: allow only dbt version 1.6+
Browse files Browse the repository at this point in the history
  • Loading branch information
svipulrao98 committed Aug 19, 2024
1 parent c06eeea commit 0bfac1c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions ci/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ setuptools>=18.0.1
six>=1.14.0
tox
twine
packaging
2 changes: 2 additions & 0 deletions src/datapilot/core/platforms/dbt/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@


FOLDER = "folder"

SUPPORTED_DBT_VERSION = "1.6"
10 changes: 9 additions & 1 deletion src/datapilot/core/platforms/dbt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from dbt_artifacts_parser.parser import parse_catalog
from dbt_artifacts_parser.parser import parse_manifest

from datapilot.core.platforms.dbt.constants import BASE
from datapilot.core.platforms.dbt.constants import BASE, SUPPORTED_DBT_VERSION
from datapilot.core.platforms.dbt.constants import FOLDER
from datapilot.core.platforms.dbt.constants import INTERMEDIATE
from datapilot.core.platforms.dbt.constants import MART
Expand All @@ -31,6 +31,8 @@
from datapilot.utils.utils import is_superset_path
from datapilot.utils.utils import load_json

from packaging import version

MODEL_TYPE_PATTERNS = {
STAGING: r"^stg_.*", # Example: models starting with 'stg_'
MART: r"^(mrt_|mart_|fct_|dim_).*", # Example: models starting with 'mrt_' or 'mart_'
Expand Down Expand Up @@ -73,6 +75,12 @@ def load_manifest(manifest_path: str) -> Manifest:

try:
manifest: Manifest = parse_manifest(manifest_dict)
dbt_version: version.Version = version.parse(manifest.metadata.dbt_version)

if dbt_version < version.parse(SUPPORTED_DBT_VERSION):
# raise a valueerror
raise ValueError(f"Unsupported DBT version: {dbt_version}. Minimum required version is {SUPPORTED_DBT_VERSION}.")

except ValueError as e:
raise AltimateInvalidManifestError(f"Invalid manifest file: {manifest_path}. Error: {e}") from e

Expand Down

0 comments on commit 0bfac1c

Please sign in to comment.