From 197195c7ed86f8d230909b39946d96dc5416f98e Mon Sep 17 00:00:00 2001 From: Ignacio Van Droogenbroeck Date: Mon, 24 Nov 2025 15:22:32 -0300 Subject: [PATCH] fix: Correct fresh connection creation in pool cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed AttributeError where cleanup tried to access self.db_path which doesn't exist in SimpleDuckDBPool. Fresh connections now created using the same pattern as _initialize_pool(): 1. duckdb.connect() (no path) 2. Apply configure_fn if provided This matches how the pool creates connections initially. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- api/duckdb_pool_simple.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/api/duckdb_pool_simple.py b/api/duckdb_pool_simple.py index a85dc2f5..f03710ae 100644 --- a/api/duckdb_pool_simple.py +++ b/api/duckdb_pool_simple.py @@ -171,7 +171,17 @@ def get_connection(self, timeout: float = 5.0): pass # Create and return a fresh connection to the pool - fresh_conn = duckdb.connect(self.db_path) + fresh_conn = duckdb.connect() + + # Apply configuration if provided + if self.configure_fn: + try: + self.configure_fn(fresh_conn) + except Exception as config_error: + logger.error(f"Failed to configure fresh connection: {config_error}") + fresh_conn.close() + raise + self.pool.put(fresh_conn) def get_metrics(self) -> Dict[str, Any]: