You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This module provides the application-level models and data adapters required to interface with remote DuckLake resources over S3. It wraps low-level database operations into unified interfaces (`File`, `DuckDataset`, and `DuckGroup`) and implements resilient database connection management via async context managers.
4
+
5
+
## Features
6
+
7
+
***Deterministic Resource Management**: Implements asynchronous context managers (`async with`) across clients and database adapters to prevent DuckDB file locks and connection leaks.
8
+
***Fail-Safe Cleanups**: Features fallback `__del__` destructors to safely terminate remaining active engines during garbage collection or interpreter shutdown.
9
+
***Intelligent Syncing**: Employs an `update_on_close` mechanism to optionally push state changes back to S3 automatically upon exiting a context.
10
+
***SQLAlchemy Eager Loading Fixes**: Optimizes attribute mappings using isolated path strategies (`joinedload` vs. `contains_eager`) based on query parameters.
11
+
***Resilient S3 Verifications**: Gracefully intercepts 404 responses during S3 download handshakes to stop failing connection retry loops early.
12
+
13
+
---
14
+
15
+
## Architecture Overview
16
+
17
+
The system separates the raw database management layer (Adapters) from the client wrapper layer (Client Models).
18
+
19
+
1.**Adapters (`BaseAdapter`)**: Track local and remote `.duckdb` target states, manage connections, handle S3 transfers, and expose scoped SQLAlchemy transaction sessions.
Using `async with` blocks guarantees deterministic resource teardown. The moment execution exits the context layout block—even due to a runtime crash—all engines are disposed of cleanly.
0 commit comments