Skip to content

Commit

Permalink
fix: pass mp context to base adapter in dbt-core 1.8+
Browse files Browse the repository at this point in the history
  • Loading branch information
z3z1ma committed Jun 14, 2024
1 parent 589be91 commit 3a0d14e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changes/0.13.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.13.1 - 2024-06-14
### Fixed
* Missing second argument for BaseAdapter in dbt-core 1.8+
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).


## 0.13.1 - 2024-06-14
### Fixed
* Missing second argument for BaseAdapter in dbt-core 1.8+

## 0.13.0 - 2024-06-12
### Added
* Test with multiple version of dbt core
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dbt-osmosis"
version = "0.13.0"
version = "0.13.1"
description = "A dbt server and suite of optional developer tools to make developing with dbt delightful."
authors = ["z3z1ma <butler.alex2010@gmail.com>"]
license = "Apache-2.0"
Expand Down
10 changes: 7 additions & 3 deletions src/dbt_osmosis/vendored/dbt_core_interface/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

# region dbt-core-interface imports & monkey patches


if 1: # this stops ruff from complaining about the import order
import dbt.adapters.factory

Expand Down Expand Up @@ -405,7 +404,7 @@ def from_config(cls, config: DbtConfiguration) -> "DbtProject":
threads=config.threads,
)

def get_adapter_cls(self) -> "BaseAdapter":
def get_adapter_cls(self) -> Type["BaseAdapter"]:
"""Get the adapter class associated with the dbt profile."""
return get_adapter_class_by_name(self.config.credentials.type)

Expand All @@ -421,7 +420,12 @@ def initialize_adapter(self) -> None:
LOGGER.debug(f"Failed to cleanup adapter connections: {e}")
# The adapter.setter verifies connection, resets TTL, and updates adapter ref on config
# this is thread safe by virtue of the adapter_mutex on the adapter.setter
self.adapter = self.get_adapter_cls()(self.config)
try:
self.adapter = self.get_adapter_cls()(self.config)
except TypeError:
from dbt.mp_context import get_mp_context

self.adapter = self.get_adapter_cls()(self.config, get_mp_context())

@property
def adapter(self) -> "BaseAdapter":
Expand Down

0 comments on commit 3a0d14e

Please sign in to comment.