MCPcopy Create free account
hub / github.com/RightNow-AI/rightnow-cli / _initialize_database

Method _initialize_database

rightnow_cli/cache.py:32–63  ·  view source on GitHub ↗

Initialize SQLite database for metadata storage.

(self)

Source from the content-addressed store, hash-verified

30 self.kernels_dir.mkdir(parents=True, exist_ok=True)
31
32 def _initialize_database(self):
33 """Initialize SQLite database for metadata storage."""
34 with sqlite3.connect(self.db_path) as conn:
35 cursor = conn.cursor()
36 cursor.execute("""
37 CREATE TABLE IF NOT EXISTS kernel_metadata (
38 id TEXT PRIMARY KEY,
39 model_name TEXT NOT NULL,
40 operation TEXT NOT NULL,
41 created_at TIMESTAMP NOT NULL,
42 last_used TIMESTAMP NOT NULL,
43 performance_metrics TEXT,
44 constraints TEXT,
45 file_path TEXT NOT NULL,
46 checksum TEXT NOT NULL
47 )
48 """)
49
50 cursor.execute("""
51 CREATE TABLE IF NOT EXISTS optimization_history (
52 id INTEGER PRIMARY KEY AUTOINCREMENT,
53 model_name TEXT NOT NULL,
54 operation TEXT NOT NULL,
55 timestamp TIMESTAMP NOT NULL,
56 baseline_time_ms REAL,
57 optimized_time_ms REAL,
58 speedup REAL,
59 memory_usage_mb REAL,
60 notes TEXT
61 )
62 """)
63 conn.commit()
64
65 def get_config_path(self) -> Path:
66 """Get the config file path."""

Callers 1

__init__Method · 0.95

Calls 1

executeMethod · 0.45

Tested by

no test coverage detected