sqlsaber 0.24.0__py3-none-any.whl → 0.26.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sqlsaber might be problematic. Click here for more details.
- sqlsaber/agents/__init__.py +2 -2
- sqlsaber/agents/base.py +5 -2
- sqlsaber/agents/mcp.py +1 -1
- sqlsaber/agents/pydantic_ai_agent.py +208 -133
- sqlsaber/cli/commands.py +17 -26
- sqlsaber/cli/completers.py +2 -0
- sqlsaber/cli/database.py +18 -7
- sqlsaber/cli/display.py +29 -9
- sqlsaber/cli/interactive.py +28 -16
- sqlsaber/cli/streaming.py +15 -17
- sqlsaber/cli/threads.py +10 -6
- sqlsaber/config/database.py +3 -1
- sqlsaber/config/settings.py +25 -2
- sqlsaber/database/__init__.py +55 -1
- sqlsaber/database/base.py +124 -0
- sqlsaber/database/csv.py +133 -0
- sqlsaber/database/duckdb.py +313 -0
- sqlsaber/database/mysql.py +345 -0
- sqlsaber/database/postgresql.py +328 -0
- sqlsaber/database/resolver.py +7 -3
- sqlsaber/database/schema.py +69 -742
- sqlsaber/database/sqlite.py +258 -0
- sqlsaber/mcp/mcp.py +1 -1
- sqlsaber/tools/sql_tools.py +1 -1
- {sqlsaber-0.24.0.dist-info → sqlsaber-0.26.0.dist-info}/METADATA +45 -10
- sqlsaber-0.26.0.dist-info/RECORD +52 -0
- sqlsaber/database/connection.py +0 -511
- sqlsaber-0.24.0.dist-info/RECORD +0 -47
- {sqlsaber-0.24.0.dist-info → sqlsaber-0.26.0.dist-info}/WHEEL +0 -0
- {sqlsaber-0.24.0.dist-info → sqlsaber-0.26.0.dist-info}/entry_points.txt +0 -0
- {sqlsaber-0.24.0.dist-info → sqlsaber-0.26.0.dist-info}/licenses/LICENSE +0 -0
sqlsaber/database/resolver.py
CHANGED
|
@@ -23,7 +23,7 @@ class ResolvedDatabase:
|
|
|
23
23
|
connection_string: str # Canonical connection string for DatabaseConnection factory
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
SUPPORTED_SCHEMES = {"postgresql", "mysql", "sqlite", "csv"}
|
|
26
|
+
SUPPORTED_SCHEMES = {"postgresql", "mysql", "sqlite", "duckdb", "csv"}
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
def _is_connection_string(s: str) -> bool:
|
|
@@ -67,8 +67,8 @@ def resolve_database(
|
|
|
67
67
|
scheme = urlparse(spec).scheme
|
|
68
68
|
if scheme in {"postgresql", "mysql"}:
|
|
69
69
|
db_name = urlparse(spec).path.lstrip("/") or "database"
|
|
70
|
-
elif scheme in {"sqlite", "csv"}:
|
|
71
|
-
db_name = Path(urlparse(spec).path).stem
|
|
70
|
+
elif scheme in {"sqlite", "duckdb", "csv"}:
|
|
71
|
+
db_name = Path(urlparse(spec).path).stem or "database"
|
|
72
72
|
else: # should not happen because of SUPPORTED_SCHEMES
|
|
73
73
|
db_name = "database"
|
|
74
74
|
return ResolvedDatabase(name=db_name, connection_string=spec)
|
|
@@ -83,6 +83,10 @@ def resolve_database(
|
|
|
83
83
|
if not path.exists():
|
|
84
84
|
raise DatabaseResolutionError(f"SQLite file '{spec}' not found.")
|
|
85
85
|
return ResolvedDatabase(name=path.stem, connection_string=f"sqlite:///{path}")
|
|
86
|
+
if path.suffix.lower() in {".duckdb", ".ddb"}:
|
|
87
|
+
if not path.exists():
|
|
88
|
+
raise DatabaseResolutionError(f"DuckDB file '{spec}' not found.")
|
|
89
|
+
return ResolvedDatabase(name=path.stem, connection_string=f"duckdb:///{path}")
|
|
86
90
|
|
|
87
91
|
# 3. Must be a configured name
|
|
88
92
|
db_cfg: DatabaseConfig | None = config_mgr.get_database(spec)
|