dbagent-cli 0.9.5__tar.gz → 0.9.7__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.5 → dbagent_cli-0.9.7}/PKG-INFO +1 -1
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/__init__.py +1 -1
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/agent/generator.py +10 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/agent/pipeline.py +17 -5
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/connectors/base.py +4 -1
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/connectors/relational.py +5 -1
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent_cli.egg-info/PKG-INFO +1 -1
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/pyproject.toml +1 -1
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/README.md +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/agent/confidence.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/agent/conversation.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/agent/doctor.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/agent/error_classifier.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/agent/recommender.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/agent/validator.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/cli.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/config.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/connectors/factory.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/connectors/mongo.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/execution/__init__.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/execution/cache.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/execution/changeset.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/execution/cost.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/execution/recovery.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/execution/sandbox.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/execution/streaming.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/llm/anthropic_provider.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/llm/auto_setup.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/llm/base.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/llm/deepseek_provider.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/llm/factory.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/llm/gemini_provider.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/llm/groq_provider.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/llm/mistral_provider.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/llm/mock_provider.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/llm/ollama_provider.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/llm/openai_provider.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/llm/openrouter_provider.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/schema/cache.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/schema/formatter.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/schema/graph.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/schema/ground_truth.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/schema/models.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/schema/retriever.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/schema/selector.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/security/__init__.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/security/audit.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/security/environment.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/security/masking.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/security/modes.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/security/rbac.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/semantic/__init__.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/semantic/dictionary.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/semantic/knowledge.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/semantic/templates.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/sql/__init__.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/sql/optimizer.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/sql/validator.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/ui/chat_screen.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/ui/console.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/ui/grid_window.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/ui/viewer.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent/ui/visualizer.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent_cli.egg-info/SOURCES.txt +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent_cli.egg-info/dependency_links.txt +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent_cli.egg-info/entry_points.txt +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent_cli.egg-info/requires.txt +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/dbagent_cli.egg-info/top_level.txt +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/setup.cfg +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/tests/test_cache.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/tests/test_cli.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/tests/test_connectors.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/tests/test_direct_sql.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/tests/test_doctor_and_viz.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/tests/test_generator.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/tests/test_graph.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/tests/test_knowledge.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/tests/test_providers.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/tests/test_recovery.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/tests/test_safety.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/tests/test_sandbox.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/tests/test_schema.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/tests/test_security.py +0 -0
- {dbagent_cli-0.9.5 → dbagent_cli-0.9.7}/tests/test_semantic.py +0 -0
|
@@ -168,11 +168,21 @@ class ScriptGenerator:
|
|
|
168
168
|
"mappings also", "find all mappings", "check links", "check mappings",
|
|
169
169
|
"is fk_", "are fk_", "is pk_", "are pk_", "difference between", "compare",
|
|
170
170
|
"tell me", "check it and tell me", "check and tell me", "same or different",
|
|
171
|
+
"flow diagram", "flow chart", "give the flow diagram", "give the diagram",
|
|
172
|
+
"show flow diagram", "give diagram", "show diagram", "architecture diagram",
|
|
171
173
|
]
|
|
172
174
|
for kw in analysis_keywords:
|
|
173
175
|
if kw in prompt_lower:
|
|
174
176
|
return "analysis"
|
|
175
177
|
|
|
178
|
+
# Regex for "how <X> and <Y> were/are linked/connected/related"
|
|
179
|
+
if re.search(r'\bhow\b.*\b(?:linked|connected|related|mapped|joined)\b', prompt_lower):
|
|
180
|
+
return "analysis"
|
|
181
|
+
|
|
182
|
+
# Regex for diagram / blueprint requests
|
|
183
|
+
if re.search(r'\b(?:flow\s+diagram|diagram|flow\s+chart|blueprint|er\s+diagram)\b', prompt_lower):
|
|
184
|
+
return "analysis"
|
|
185
|
+
|
|
176
186
|
# Comparative analysis questions (e.g. "is fk_site_group_id and fk_group_id same", "are table_a and table_b related")
|
|
177
187
|
if re.search(r'\b(?:is|are)\b.*\b(?:same|different|difference|related|equal|linked)\b', prompt_lower):
|
|
178
188
|
return "analysis"
|
|
@@ -238,12 +238,18 @@ class QueryPipeline:
|
|
|
238
238
|
exact, fuzzy = [], []
|
|
239
239
|
|
|
240
240
|
# Inherit active tables from conversation context if follow-up prompt doesn't name tables explicitly
|
|
241
|
+
is_inherited = False
|
|
241
242
|
if not exact and not fuzzy:
|
|
242
243
|
inherited = self.conversation.get_active_tables()
|
|
243
244
|
if inherited:
|
|
244
|
-
exact = inherited[:
|
|
245
|
+
exact = inherited[:8]
|
|
246
|
+
is_inherited = True
|
|
245
247
|
|
|
246
|
-
|
|
248
|
+
effective_prompt = user_prompt
|
|
249
|
+
if is_inherited and exact:
|
|
250
|
+
effective_prompt = f"Focus strictly on the architecture, linkages, and data flow between {', '.join(exact[:5])}. User request: {user_prompt}"
|
|
251
|
+
|
|
252
|
+
sub_schema, join_steps = self._get_fast_schema_context(effective_prompt, exact, fuzzy)
|
|
247
253
|
result.schema = sub_schema
|
|
248
254
|
result.join_steps = join_steps
|
|
249
255
|
|
|
@@ -258,9 +264,9 @@ class QueryPipeline:
|
|
|
258
264
|
source="user_guidance",
|
|
259
265
|
)
|
|
260
266
|
|
|
261
|
-
kb_context = self.knowledge_base.format_prompt_context(self.db_name,
|
|
267
|
+
kb_context = self.knowledge_base.format_prompt_context(self.db_name, effective_prompt, exact + fuzzy)
|
|
262
268
|
conv_history = self.conversation.format_context_for_prompt()
|
|
263
|
-
analysis_prompt = f"{kb_context}\n\n{
|
|
269
|
+
analysis_prompt = f"{kb_context}\n\n{effective_prompt}" if kb_context else effective_prompt
|
|
264
270
|
|
|
265
271
|
result.message = self.generator.generate_analysis_response(
|
|
266
272
|
schema=sub_schema,
|
|
@@ -594,10 +600,16 @@ class QueryPipeline:
|
|
|
594
600
|
)
|
|
595
601
|
|
|
596
602
|
if result.success:
|
|
603
|
+
sql_tables = set()
|
|
604
|
+
if result.sql:
|
|
605
|
+
import re as _re
|
|
606
|
+
for m in _re.findall(r'\b(?:FROM|JOIN)\s+([a-zA-Z0-9_]+)', result.sql, _re.IGNORECASE):
|
|
607
|
+
sql_tables.add(m.lower())
|
|
608
|
+
turn_tables = list(set((exact or []) + (fuzzy or []) + list(sql_tables)))
|
|
597
609
|
self.conversation.add_turn(
|
|
598
610
|
user_prompt=user_prompt,
|
|
599
611
|
sql=result.sql,
|
|
600
|
-
tables=
|
|
612
|
+
tables=turn_tables,
|
|
601
613
|
is_chat=False,
|
|
602
614
|
)
|
|
603
615
|
|
|
@@ -63,7 +63,10 @@ class BaseConnector(ABC):
|
|
|
63
63
|
"onto", "over", "under", "before", "after", "during", "since", "until", "across", "along",
|
|
64
64
|
"throughout", "outside", "inside", "above", "below", "behind", "beyond", "plus", "except",
|
|
65
65
|
"but", "against", "towards", "upon", "within", "without", "give", "also", "explain", "look",
|
|
66
|
-
"know", "make", "take", "help", "view", "count", "done", "good", "nice", "okay", "fine"
|
|
66
|
+
"know", "make", "take", "help", "view", "count", "done", "good", "nice", "okay", "fine",
|
|
67
|
+
"flow", "diagram", "chart", "graph", "link", "links", "structure", "design", "model", "blueprint",
|
|
68
|
+
"mapping", "mappings", "overview", "query", "code", "script", "report", "summary", "relation",
|
|
69
|
+
"relations", "relationship", "relationships", "architecture"
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
raw_tokens = set(re.findall(r'\b[a-zA-Z0-9_]+\b', prompt_lower))
|
|
@@ -47,7 +47,7 @@ def _fuzzy_match_tables(table_names: List[str], user_prompt: str) -> Tuple[List[
|
|
|
47
47
|
exact: List[str] = []
|
|
48
48
|
fuzzy: List[str] = []
|
|
49
49
|
|
|
50
|
-
# Extract meaningful words from the prompt (3+ chars, skip SQL keywords)
|
|
50
|
+
# Extract meaningful words from the prompt (3+ chars, skip SQL keywords and diagram meta-terms)
|
|
51
51
|
sql_keywords = {
|
|
52
52
|
"select", "from", "where", "join", "left", "right", "inner", "outer",
|
|
53
53
|
"order", "group", "having", "limit", "offset", "insert", "update",
|
|
@@ -57,6 +57,10 @@ def _fuzzy_match_tables(table_names: List[str], user_prompt: str) -> Tuple[List[
|
|
|
57
57
|
"drop", "index", "primary", "foreign", "key", "null", "default",
|
|
58
58
|
"hour", "minute", "day", "week", "month", "year", "ago", "today",
|
|
59
59
|
"give", "tell", "want", "need", "please", "display", "fetch",
|
|
60
|
+
"flow", "diagram", "chart", "graph", "link", "links", "structure",
|
|
61
|
+
"design", "model", "blueprint", "mapping", "mappings", "overview",
|
|
62
|
+
"query", "code", "script", "report", "summary", "relation",
|
|
63
|
+
"relations", "relationship", "relationships", "architecture", "check",
|
|
60
64
|
}
|
|
61
65
|
prompt_words = set()
|
|
62
66
|
for word in re.findall(r"\b[a-z_][a-z0-9_]*\b", prompt_lower):
|
|
@@ -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.7"
|
|
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
|