diff --git a/opendbt/__init__.py b/opendbt/__init__.py index 1eb65c7..0636df8 100644 --- a/opendbt/__init__.py +++ b/opendbt/__init__.py @@ -3,7 +3,16 @@ import sys from pathlib import Path +###################### from dbt.cli.main import dbtRunner as DbtCliRunner + +###################### +from opendbt.dbt import patch_dbt + +patch_dbt() +###################### +from opendbt.utils import Utils + from dbt.cli.main import dbtRunnerResult from dbt.config import PartialProject from dbt.contracts.graph.manifest import Manifest @@ -11,14 +20,6 @@ from dbt.exceptions import DbtRuntimeError from dbt.task.base import get_nearest_project_dir -from opendbt.dbt import patch_dbt -from opendbt.utils import Utils - -###################### -patch_dbt() - - -###################### class OpenDbtLogger: _log = None diff --git a/opendbt/dbt/__init__.py b/opendbt/dbt/__init__.py index 247963e..8b3535c 100644 --- a/opendbt/dbt/__init__.py +++ b/opendbt/dbt/__init__.py @@ -7,28 +7,14 @@ def patch_dbt(): # Monkey Patching! Override dbt lib code with new one # ================================================================================================================ dbt_version = Version(dbt.version.get_installed_version().to_version_string(skip_matcher=True)) - if Version("1.6.0") <= dbt_version < Version("1.7.0"): + if Version("1.6.0") <= dbt_version < Version("1.8.0"): from opendbt.dbt.v17.task.docs.generate import OpenDbtGenerateTask dbt.task.generate.GenerateTask = OpenDbtGenerateTask from opendbt.dbt.v17.adapters.factory import OpenDbtAdapterContainer dbt.adapters.factory.FACTORY = OpenDbtAdapterContainer() from opendbt.dbt.v17.task.run import ModelRunner dbt.task.run.ModelRunner = ModelRunner - elif Version("1.7.0") <= dbt_version < Version("1.8.0"): - from opendbt.dbt.v17.task.docs.generate import OpenDbtGenerateTask - dbt.task.generate.GenerateTask = OpenDbtGenerateTask - from opendbt.dbt.v17.adapters.factory import OpenDbtAdapterContainer - dbt.adapters.factory.FACTORY = OpenDbtAdapterContainer() - from opendbt.dbt.v17.task.run import ModelRunner - dbt.task.run.ModelRunner = ModelRunner - elif Version("1.8.0") <= dbt_version < Version("1.9.0"): - from opendbt.dbt.v18.task.docs.generate import OpenDbtGenerateTask - dbt.task.docs.generate.GenerateTask = OpenDbtGenerateTask - from opendbt.dbt.v18.adapters.factory import OpenDbtAdapterContainer - dbt.adapters.factory.FACTORY = OpenDbtAdapterContainer() - from opendbt.dbt.v18.task.run import ModelRunner - dbt.task.run.ModelRunner = ModelRunner - elif Version("1.9.0") >= dbt_version < Version("1.10.0"): + elif Version("1.8.0") <= dbt_version < Version("1.10.0"): from opendbt.dbt.v18.task.docs.generate import OpenDbtGenerateTask dbt.task.docs.generate.GenerateTask = OpenDbtGenerateTask from opendbt.dbt.v18.adapters.factory import OpenDbtAdapterContainer