Skip to content

Commit

Permalink
updates dbt support to 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolfix committed May 25, 2024
1 parent e9e62af commit 6306270
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 21 deletions.
2 changes: 1 addition & 1 deletion dlt/helpers/dbt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from dlt.helpers.dbt.runner import create_runner, DBTPackageRunner

DEFAULT_DBT_VERSION = ">=1.1,<1.6"
DEFAULT_DBT_VERSION = ">=1.5,<1.9"

# a map of destination names to dbt package names in case they don't match the pure destination name
DBT_DESTINATION_MAP = {
Expand Down
12 changes: 0 additions & 12 deletions dlt/helpers/dbt/dbt_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
# https://stackoverflow.com/questions/48619517/call-a-click-command-from-code

import dbt.logger
from dbt.events import functions
from dbt.contracts import results as dbt_results
except ModuleNotFoundError:
raise MissingDependencyException("DBT Core", ["dbt-core"])
Expand Down Expand Up @@ -56,17 +55,6 @@ def set_path_wrapper(self: dbt.logger.LogManager, path: str) -> None:
self._file_handler.set_path(path)
_DBT_LOGGER_INITIALIZED = True

# def setup_event_logger_wrapper(log_path: str, level_override:str = None) -> None:
# global _DBT_LOGGER_INITIALIZED

# if not _DBT_LOGGER_INITIALIZED:
# functions.setup_event_logger(log_path, level.lower())
# # force log level as file is debug only
# # functions.this.FILE_LOG.setLevel(level)
# # functions.this.FILE_LOG.handlers[0].setLevel(level)
# _DBT_LOGGER_INITIALIZED = True

# dbt.main.setup_event_logger = setup_event_logger_wrapper
dbt.logger.LogManager.set_path = set_path_wrapper # type: ignore

globs = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ def resource(url: str):
# dlt bigquery custom destination
# we can use the dlt provided credentials class
# to retrieve the gcp credentials from the secrets
@dlt.destination(name="bigquery", loader_file_format="parquet", batch_size=0, naming_convention="snake_case")
@dlt.destination(
name="bigquery", loader_file_format="parquet", batch_size=0, naming_convention="snake_case"
)
def bigquery_insert(
items, table=BIGQUERY_TABLE_ID, credentials: GcpServiceAccountCredentials = dlt.secrets.value
) -> None:
Expand Down
11 changes: 4 additions & 7 deletions tests/helpers/dbt_tests/test_runner_dbt_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,13 @@ def client() -> Iterator[PostgresClient]:


PACKAGE_PARAMS = [
# ("postgres", "1.1.3"),
# ("postgres", "1.2.4"),
# ("postgres", "1.3.2"),
# ("postgres", "1.4.0"),
("postgres", "1.5.2"),
("postgres", "1.6.13"),
("postgres", "1.8.1"),
("postgres", None),
# ("snowflake", "1.4.0"),
("snowflake", "1.5.2"),
("snowflake", "1.6.13"),
("snowflake", "1.8.2"),
("snowflake", None),
]
PACKAGE_IDS = [
Expand Down Expand Up @@ -82,10 +79,10 @@ def test_infer_venv_deps() -> None:
# provide version ranges
requirements = _create_dbt_deps(["duckdb"], dbt_version=">3")
# special duckdb dependency
assert requirements[:-1] == ["dbt-core>3", "dbt-duckdb", "duckdb==0.9.2"]
assert requirements[:-1] == ["dbt-core>3", "dbt-duckdb", "duckdb==0.10.3"]
# we do not validate version ranges, pip will do it and fail when creating venv
requirements = _create_dbt_deps(["motherduck"], dbt_version="y")
assert requirements[:-1] == ["dbt-corey", "dbt-duckdb", "duckdb==0.9.2"]
assert requirements[:-1] == ["dbt-corey", "dbt-duckdb", "duckdb==0.10.3"]


def test_default_profile_name() -> None:
Expand Down

0 comments on commit 6306270

Please sign in to comment.