Skip to content

Commit

Permalink
fix: dbt 1.5 compatibility (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
ciklista authored May 24, 2023
1 parent c43cf7f commit 1ede80d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion dbt_invoke/internal/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
import platform
import re
from dbt.task.base import get_nearest_project_dir

try:
from importlib.metadata import version

DBT_VERSION = version('dbt-core')

except ImportError:
import pkg_resources

DBT_VERSION = pkg_resources.get_distribution('dbt-core').version

from ruamel.yaml import YAML, YAMLError

MACROS = {
Expand Down Expand Up @@ -107,7 +118,10 @@ def get_project_info(ctx, project_dir=None):
:return: None
"""
project = Project(project_dir)
project_path = get_nearest_project_dir(project)
if DBT_VERSION < '1.5.0':
project_path = get_nearest_project_dir(project)
else:
project_path = get_nearest_project_dir(project.project_dir)
project_yml_path = Path(project_path, 'dbt_project.yml')
# Get project configuration values from dbt_project.yml
# (or use dbt defaults)
Expand Down
2 changes: 1 addition & 1 deletion dbt_invoke/internal/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.2.1'
__version__ = '0.2.2'

0 comments on commit 1ede80d

Please sign in to comment.