Skip to content

Commit da14e9a

Browse files
committed
feat: improve connection closing for duckdb, trigger release
1 parent 6549f35 commit da14e9a

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "dbt-core-interface"
3-
version = "1.1.2"
3+
version = "1.1.3"
44
dynamic = []
55
description = "Dbt Core Interface"
66
authors = [

src/dbt_core_interface/project.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,9 @@ def _ensure_connection(f: t.Callable[P, T]) -> t.Callable[P, T]:
192192
@functools.wraps(f)
193193
def wrapper(*args: P.args, **kwargs: P.kwargs) -> T:
194194
self = t.cast(DbtProject, args[0])
195-
_ = self.adapter.connections.set_connection_name()
196-
return f(*args, **kwargs)
195+
is_duckdb = self.adapter.connections.TYPE == "duckdb"
196+
with self.adapter.connection_named(f.__name__, should_release_connection=is_duckdb):
197+
return f(*args, **kwargs)
197198

198199
return wrapper
199200

@@ -872,6 +873,7 @@ def _lint(node: ManifestNode) -> list[LintingRecord]:
872873
all_records: list[LintingRecord] = []
873874
for records in self.pool.map(_lint, self.manifest.nodes.values()):
874875
all_records.extend(records)
876+
self.adapter.cleanup_connections()
875877

876878
return all_records
877879
elif isinstance(sql, str):
@@ -935,7 +937,9 @@ def _format(node: ManifestNode) -> bool:
935937
success = False
936938
return success
937939

938-
return all(res for res in self.pool.map(_format, self.manifest.nodes.values())), None
940+
result = all(res for res in self.pool.map(_format, self.manifest.nodes.values())), None
941+
self.adapter.cleanup_connections()
942+
return result
939943
if isinstance(sql, str):
940944
logger.info(f"Formatting SQL string: {sql[:100]}")
941945
result = lint.lint_string_wrapped(sql, fname="stdin", fix=True)

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)