Skip to content

Commit

Permalink
forces local duckdb version when installing dbt venv
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolfix committed Sep 27, 2023
1 parent d158733 commit 417357c
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions dlt/helpers/dbt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,24 @@ def _create_dbt_deps(destination_names: List[str], dbt_version: str = DEFAULT_DB
else:
dbt_version = ""

all_packages = destination_names + ["core"]
# add version only to the core package. the other packages versions must be resolved by pip
all_packages = ["core" + dbt_version] + destination_names
for idx, package in enumerate(all_packages):
# TODO: if we have more cases like this, move to destination capabilities
package = DBT_DESTINATION_MAP.get(package, package)
package_w_ver = "dbt-" + package + dbt_version
package = "dbt-" + DBT_DESTINATION_MAP.get(package, package)
# verify package
pkg_resources.Requirement.parse(package_w_ver)
all_packages[idx] = package_w_ver
pkg_resources.Requirement.parse(package)
all_packages[idx] = package

dlt_requirement = get_installed_requirement_string()

return all_packages + [dlt_requirement]
# get additional requirements
additional_deps: List[str] = []
if "duckdb" in destination_names or "motherduck" in destination_names:
from importlib.metadata import version as pkg_version
# force locally installed duckdb
additional_deps = ["duckdb" + "==" + pkg_version("duckdb")]

print(all_packages + [dlt_requirement] + additional_deps)
return all_packages + [dlt_requirement] + additional_deps


def restore_venv(venv_dir: str, destination_names: List[str], dbt_version: str = DEFAULT_DBT_VERSION) -> Venv:
Expand Down

0 comments on commit 417357c

Please sign in to comment.