dbagent-cli 0.9.2__tar.gz → 0.9.4__tar.gz
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.
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/PKG-INFO +1 -1
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/__init__.py +1 -1
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/agent/generator.py +4 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/agent/pipeline.py +27 -4
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/schema/ground_truth.py +31 -3
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent_cli.egg-info/PKG-INFO +1 -1
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/pyproject.toml +1 -1
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/README.md +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/agent/confidence.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/agent/conversation.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/agent/doctor.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/agent/error_classifier.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/agent/recommender.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/agent/validator.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/cli.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/config.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/connectors/base.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/connectors/factory.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/connectors/mongo.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/connectors/relational.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/execution/__init__.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/execution/cache.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/execution/changeset.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/execution/cost.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/execution/recovery.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/execution/sandbox.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/execution/streaming.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/llm/anthropic_provider.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/llm/auto_setup.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/llm/base.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/llm/deepseek_provider.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/llm/factory.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/llm/gemini_provider.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/llm/groq_provider.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/llm/mistral_provider.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/llm/mock_provider.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/llm/ollama_provider.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/llm/openai_provider.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/llm/openrouter_provider.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/schema/cache.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/schema/formatter.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/schema/graph.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/schema/models.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/schema/retriever.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/schema/selector.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/security/__init__.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/security/audit.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/security/environment.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/security/masking.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/security/modes.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/security/rbac.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/semantic/__init__.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/semantic/dictionary.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/semantic/knowledge.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/semantic/templates.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/sql/__init__.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/sql/optimizer.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/sql/validator.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/ui/chat_screen.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/ui/console.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/ui/grid_window.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/ui/viewer.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent/ui/visualizer.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent_cli.egg-info/SOURCES.txt +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent_cli.egg-info/dependency_links.txt +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent_cli.egg-info/entry_points.txt +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent_cli.egg-info/requires.txt +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/dbagent_cli.egg-info/top_level.txt +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/setup.cfg +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/tests/test_cache.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/tests/test_cli.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/tests/test_connectors.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/tests/test_direct_sql.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/tests/test_doctor_and_viz.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/tests/test_generator.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/tests/test_graph.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/tests/test_knowledge.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/tests/test_providers.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/tests/test_recovery.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/tests/test_safety.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/tests/test_sandbox.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/tests/test_schema.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/tests/test_security.py +0 -0
- {dbagent_cli-0.9.2 → dbagent_cli-0.9.4}/tests/test_semantic.py +0 -0
|
@@ -162,6 +162,10 @@ class ScriptGenerator:
|
|
|
162
162
|
"check with my previous context", "check with previous context", "previous context",
|
|
163
163
|
"complete architecture", "scope architecture", "tenant level to user level",
|
|
164
164
|
"tenant level", "user level",
|
|
165
|
+
"tables that were linked", "tables linked with", "linked with", "links of",
|
|
166
|
+
"related tables", "related tebales", "table mappings", "related tables mappings",
|
|
167
|
+
"related tebales mappings", "not correct", "not right", "check all the tables",
|
|
168
|
+
"mappings also", "find all mappings", "check links", "check mappings",
|
|
165
169
|
]
|
|
166
170
|
for kw in analysis_keywords:
|
|
167
171
|
if kw in prompt_lower:
|
|
@@ -157,17 +157,40 @@ class QueryPipeline:
|
|
|
157
157
|
max_tables=8,
|
|
158
158
|
)
|
|
159
159
|
|
|
160
|
-
# 2. Targeted on-demand table introspection
|
|
160
|
+
# 2. Targeted on-demand table introspection with automatic junction expansion
|
|
161
161
|
target_names = list(set(exact + fuzzy))
|
|
162
162
|
if target_names:
|
|
163
|
+
try:
|
|
164
|
+
all_table_names = self.connector.get_table_names()
|
|
165
|
+
stems = set()
|
|
166
|
+
for t in target_names:
|
|
167
|
+
unprefixed = re.sub(r'^(?:ivis_|tbl_|table_|app_)', '', t.lower())
|
|
168
|
+
unprefixed = re.sub(r'(?:s|es)$', '', unprefixed)
|
|
169
|
+
if len(unprefixed) >= 3:
|
|
170
|
+
stems.add(unprefixed)
|
|
171
|
+
|
|
172
|
+
for t in all_table_names:
|
|
173
|
+
t_lower = t.lower()
|
|
174
|
+
if t in target_names:
|
|
175
|
+
continue
|
|
176
|
+
is_map = any(m in t_lower for m in ["_map", "mapping", "_rel", "_junction", "_link", "_access", "_config"])
|
|
177
|
+
matches_stem = any(s in t_lower for s in stems)
|
|
178
|
+
if (is_map and matches_stem) or sum(1 for s in stems if s in t_lower) >= 2:
|
|
179
|
+
if t not in target_names:
|
|
180
|
+
target_names.append(t)
|
|
181
|
+
if len(target_names) >= 12:
|
|
182
|
+
break
|
|
183
|
+
except Exception:
|
|
184
|
+
pass
|
|
185
|
+
|
|
163
186
|
targeted = self.connector.inspect_schema(table_names=target_names, include_samples=True, max_samples=2)
|
|
164
187
|
retriever = ContextRetriever(targeted)
|
|
165
|
-
return retriever.retrieve_context(user_prompt, exact_tables=exact, fuzzy_tables=fuzzy, max_tables=
|
|
188
|
+
return retriever.retrieve_context(user_prompt, exact_tables=exact, fuzzy_tables=fuzzy, max_tables=12)
|
|
166
189
|
|
|
167
190
|
# 3. Fallback: inspect targeted
|
|
168
|
-
targeted = self.connector.inspect_targeted(user_prompt, max_tables=
|
|
191
|
+
targeted = self.connector.inspect_targeted(user_prompt, max_tables=12, include_samples=True)
|
|
169
192
|
retriever = ContextRetriever(targeted)
|
|
170
|
-
return retriever.retrieve_context(user_prompt, exact_tables=exact, fuzzy_tables=fuzzy, max_tables=
|
|
193
|
+
return retriever.retrieve_context(user_prompt, exact_tables=exact, fuzzy_tables=fuzzy, max_tables=12)
|
|
171
194
|
|
|
172
195
|
def run(self, user_prompt: str, force: bool = False, bypass_cache: bool = False) -> PipelineResult:
|
|
173
196
|
"""
|
|
@@ -42,6 +42,8 @@ class GroundTruthValidationResult:
|
|
|
42
42
|
lines.append(f" [dim]• ... and {len(self.verified_fks) - 4} more[/dim]")
|
|
43
43
|
if self.sql_queries_checked > 0:
|
|
44
44
|
lines.append(f" [bold green]✓[/bold green] [bold white]SQL Queries Verified:[/bold white] {self.sql_queries_checked} dialect statement(s) validated against schema")
|
|
45
|
+
for missing in self.missing_tables:
|
|
46
|
+
lines.append(f" [bold yellow]⚠ Note:[/bold yellow] Query referenced [dim]{missing}[/dim]")
|
|
45
47
|
for tbl, cols in self.missing_columns.items():
|
|
46
48
|
lines.append(f" [bold red]⚠ Warning:[/bold red] Column(s) [yellow]{', '.join(cols)}[/yellow] not found in table [cyan]{tbl}[/cyan]")
|
|
47
49
|
return "\n".join(lines)
|
|
@@ -83,14 +85,40 @@ class SchemaGroundTruthValidator:
|
|
|
83
85
|
if fk_desc not in result.verified_fks:
|
|
84
86
|
result.verified_fks.append(fk_desc)
|
|
85
87
|
|
|
86
|
-
# 2. Extract and
|
|
88
|
+
# 2. Extract and validate SQL queries against physical schema
|
|
87
89
|
sql_blocks = re.findall(r'```(?:sql)?\s*([\s\S]*?)\s*```', response_text, re.IGNORECASE)
|
|
88
90
|
result.sql_queries_checked = len(sql_blocks)
|
|
91
|
+
sql_referenced_tables = set()
|
|
92
|
+
|
|
93
|
+
for block in sql_blocks:
|
|
94
|
+
# Extract FROM and JOIN table references
|
|
95
|
+
matches = re.findall(r'\b(?:FROM|JOIN)\s+([a-zA-Z0-9_]+)', block, re.IGNORECASE)
|
|
96
|
+
for m in matches:
|
|
97
|
+
m_clean = m.strip().lower()
|
|
98
|
+
sql_referenced_tables.add(m_clean)
|
|
99
|
+
|
|
100
|
+
for sql_tbl in sql_referenced_tables:
|
|
101
|
+
if sql_tbl in schema_table_map:
|
|
102
|
+
if schema_table_map[sql_tbl].name not in result.verified_tables:
|
|
103
|
+
result.verified_tables.append(schema_table_map[sql_tbl].name)
|
|
104
|
+
else:
|
|
105
|
+
# Check if it's a common alias or slight naming divergence
|
|
106
|
+
found_match = None
|
|
107
|
+
for real_tbl in schema_table_map:
|
|
108
|
+
if sql_tbl in real_tbl or real_tbl in sql_tbl:
|
|
109
|
+
found_match = schema_table_map[real_tbl].name
|
|
110
|
+
break
|
|
111
|
+
if found_match:
|
|
112
|
+
result.missing_tables.append(f"{sql_tbl} ➔ (Actual: {found_match})")
|
|
113
|
+
else:
|
|
114
|
+
result.missing_tables.append(sql_tbl)
|
|
89
115
|
|
|
90
116
|
total_checked = len(result.verified_tables)
|
|
91
|
-
if
|
|
117
|
+
if result.missing_tables:
|
|
118
|
+
result.score_pct = max(70, 100 - (len(result.missing_tables) * 15))
|
|
119
|
+
elif total_checked > 0:
|
|
92
120
|
result.score_pct = 100
|
|
93
121
|
else:
|
|
94
122
|
result.score_pct = 95
|
|
95
|
-
|
|
123
|
+
|
|
96
124
|
return result
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dbagent-cli"
|
|
7
|
-
version = "0.9.
|
|
7
|
+
version = "0.9.4"
|
|
8
8
|
description = "Enterprise AI Database Copilot, Schema Graph Introspector & Autonomous Recovery Agent (CLI)"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|