MCPcopy Create free account
hub / github.com/Bairong-Xdynamics/MistakeNotebookLearning / __init__

Method __init__

examples/utils/sql_eval.py:19–37  ·  view source on GitHub ↗

Initialize SQL tester with database schemas and execution logic Args: tables_file: Path to JSON file containing database schemas databases_dir: Directory containing SQLite database files

(self, 
                 tables_file: str = "tables.json",
                 databases_dir: str = "databases")

Source from the content-addressed store, hash-verified

17 """
18
19 def __init__(self,
20 tables_file: str = "tables.json",
21 databases_dir: str = "databases"):
22 """
23 Initialize SQL tester with database schemas and execution logic
24
25 Args:
26 tables_file: Path to JSON file containing database schemas
27 databases_dir: Directory containing SQLite database files
28 """
29 self.tables_file = tables_file
30 self.databases_dir = databases_dir
31
32 # Load database schemas from tables file
33 if os.path.exists(tables_file):
34 with open(tables_file, 'r', encoding='utf-8') as f:
35 self.tables = {db['db_id']: db for db in json.load(f)}
36 else:
37 self.tables = {}
38
39 def extract_dbid(self, question: str) -> str:
40 """Extract database ID from question.

Callers

nothing calls this directly

Calls 2

existsMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected