refactor: Rename QueryHistoryManager and OptimizedQueryHistoryManager to QueryHistoryTool and OptimizedQueryHistoryTool for consistency
This commit is contained in:
parent
45034f4cbd
commit
70a7a4a12b
2 changed files with 18 additions and 18 deletions
|
|
@ -21,7 +21,7 @@ _debug_mode = os.getenv("SQL_OPT_TEAM_DEBUG_MODE", "false").strip().lower() in {
|
|||
db = SqliteDb(db_file=_db_path)
|
||||
|
||||
sql_optimizer_team = Team(
|
||||
name="SQL Optimization Manager",
|
||||
name="SQL Optimization Team",
|
||||
model=base_model,
|
||||
members=[sql_analyst_agent, sql_optimizer_agent, sql_quality_agent, conservative_analysis_agent],
|
||||
markdown=True,
|
||||
|
|
@ -35,7 +35,7 @@ sql_optimizer_team = Team(
|
|||
store_member_responses=True,
|
||||
debug_mode=_debug_mode,
|
||||
description=(
|
||||
"Gestor responsável por receber a solicitação inicial, repartir tarefas entre especialistas, "
|
||||
"Time orquestrador responsável por receber a solicitação inicial, repartir tarefas entre especialistas, "
|
||||
"acompanhar hand-offs e consolidar a entrega final."
|
||||
),
|
||||
instructions=[
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ def _format_sql(sql_text: str) -> str:
|
|||
return formatted.strip()
|
||||
|
||||
|
||||
class QueryHistoryManager:
|
||||
"""Manages history of ranked queries to avoid duplicates in rank-queries command.
|
||||
class QueryHistoryTool:
|
||||
"""Tool for managing history of ranked queries to avoid duplicates in rank-queries command.
|
||||
|
||||
Uses SHA256 hash of SQL text to identify unique queries.
|
||||
History is stored per database/instance combination.
|
||||
|
|
@ -64,11 +64,11 @@ class QueryHistoryManager:
|
|||
history_file: Path to the JSON file storing query history
|
||||
|
||||
Example:
|
||||
>>> manager = QueryHistoryManager()
|
||||
>>> manager.is_processed("sqlserver", "nprd_2", "SELECT * FROM users")
|
||||
>>> tool = QueryHistoryTool()
|
||||
>>> tool.is_processed("sqlserver", "nprd_2", "SELECT * FROM users")
|
||||
False
|
||||
>>> manager.mark_as_processed("sqlserver", "nprd_2", "SELECT * FROM users")
|
||||
>>> manager.is_processed("sqlserver", "nprd_2", "SELECT * FROM users")
|
||||
>>> tool.mark_as_processed("sqlserver", "nprd_2", "SELECT * FROM users")
|
||||
>>> tool.is_processed("sqlserver", "nprd_2", "SELECT * FROM users")
|
||||
True
|
||||
"""
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ class QueryHistoryManager:
|
|||
DEFAULT_OUTPUT_DIR = "exemples"
|
||||
|
||||
def __init__(self, history_file: str | Path | None = None) -> None:
|
||||
"""Initialize the query history manager.
|
||||
"""Initialize the query history tool.
|
||||
|
||||
Args:
|
||||
history_file: Path to history file. Uses default if not specified.
|
||||
|
|
@ -418,7 +418,7 @@ class QueryHistoryManager:
|
|||
f"-- Total Queries: {len(sorted_entries)}",
|
||||
"-- =============================================================================",
|
||||
"",
|
||||
"-- This file is auto-generated by the Query History Manager.",
|
||||
"-- This file is auto-generated by the Query History Tool.",
|
||||
"-- It contains all queries that have been analyzed/processed.",
|
||||
"",
|
||||
]
|
||||
|
|
@ -484,10 +484,10 @@ class QueryHistoryManager:
|
|||
return count, consolidated_path
|
||||
|
||||
|
||||
class OptimizedQueryHistoryManager:
|
||||
"""Manages history of optimized/refactored queries from optimize-worst command.
|
||||
class OptimizedQueryHistoryTool:
|
||||
"""Tool for managing history of optimized/refactored queries from optimize-worst command.
|
||||
|
||||
Separate from QueryHistoryManager to track only queries that were actually
|
||||
Separate from QueryHistoryTool to track only queries that were actually
|
||||
sent through the LLM optimization process, not just listed/ranked.
|
||||
|
||||
Uses SHA256 hash of SQL text to identify unique queries.
|
||||
|
|
@ -497,18 +497,18 @@ class OptimizedQueryHistoryManager:
|
|||
history_file: Path to the JSON file storing optimization history
|
||||
|
||||
Example:
|
||||
>>> manager = OptimizedQueryHistoryManager()
|
||||
>>> manager.is_optimized("sqlserver", "nprd_2", "SELECT * FROM users")
|
||||
>>> tool = OptimizedQueryHistoryTool()
|
||||
>>> tool.is_optimized("sqlserver", "nprd_2", "SELECT * FROM users")
|
||||
False
|
||||
>>> manager.mark_as_optimized("sqlserver", "nprd_2", "SELECT * FROM users", {...})
|
||||
>>> manager.is_optimized("sqlserver", "nprd_2", "SELECT * FROM users")
|
||||
>>> tool.mark_as_optimized("sqlserver", "nprd_2", "SELECT * FROM users", {...})
|
||||
>>> tool.is_optimized("sqlserver", "nprd_2", "SELECT * FROM users")
|
||||
True
|
||||
"""
|
||||
|
||||
DEFAULT_HISTORY_FILE = "exemples/.optimized_queries_history.json"
|
||||
|
||||
def __init__(self, history_file: str | Path | None = None) -> None:
|
||||
"""Initialize the optimized query history manager.
|
||||
"""Initialize the optimized query history tool.
|
||||
|
||||
Args:
|
||||
history_file: Path to history file. Uses default if not specified.
|
||||
|
|
|
|||
Loading…
Reference in a new issue