Skip to content

Commit

Permalink
more compat changes
Browse files Browse the repository at this point in the history
  • Loading branch information
haritamar committed Jul 3, 2024
1 parent b75e222 commit 12ca33e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ types-PyYAML
types-setuptools
pandas-stubs
types-retry
types-decorator
13 changes: 6 additions & 7 deletions elementary/clients/dbt/factory.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from typing import Any, Optional
from typing import Any, Dict, Optional, Type

from dbt.version import __version__ as dbt_version_string
from packaging import version

from elementary.clients.dbt.base_dbt_runner import BaseDbtRunner
from elementary.clients.dbt.command_line_dbt_runner import CommandLineDbtRunner
from elementary.clients.dbt.subprocess_dbt_runner import SubprocessDbtRunner

DBT_VERSION = version.Version(dbt_version_string)

RUNNER_CLASS: type[CommandLineDbtRunner]
RUNNER_CLASS: Type[CommandLineDbtRunner]
if DBT_VERSION >= version.Version("1.5.0"):
from elementary.clients.dbt.api_dbt_runner import APIDbtRunner

Expand All @@ -23,13 +22,13 @@ def create_dbt_runner(
profiles_dir: Optional[str] = None,
target: Optional[str] = None,
raise_on_failure: bool = True,
env_vars: Optional[dict[str, str]] = None,
vars: Optional[dict[str, Any]] = None,
secret_vars: Optional[dict[str, Any]] = None,
env_vars: Optional[Dict[str, str]] = None,
vars: Optional[Dict[str, Any]] = None,
secret_vars: Optional[Dict[str, Any]] = None,
allow_macros_without_package_prefix: bool = False,
run_deps_if_needed: bool = True,
force_dbt_deps: bool = False,
) -> BaseDbtRunner:
) -> CommandLineDbtRunner:
return RUNNER_CLASS(
project_dir=project_dir,
profiles_dir=profiles_dir,
Expand Down
4 changes: 2 additions & 2 deletions elementary/utils/env_vars_context.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import os
from typing import Generator, Optional
from typing import Dict, Generator, Optional

from decorator import contextmanager


@contextmanager
def env_vars_context(env_vars: Optional[dict[str, str]]) -> Generator[None, None, None]:
def env_vars_context(env_vars: Optional[Dict[str, str]]) -> Generator[None, None, None]:
if env_vars is None:
yield
return
Expand Down

0 comments on commit 12ca33e

Please sign in to comment.