MCPcopy
hub / github.com/phuryn/claude-usage / insert_turns

Function insert_turns

scanner.py:559–573  ·  view source on GitHub ↗
(conn, turns)

Source from the content-addressed store, hash-verified

557
558
559def insert_turns(conn, turns):
560 conn.executemany("""
561 INSERT OR IGNORE INTO turns
562 (session_id, timestamp, model, input_tokens, output_tokens,
563 cache_read_tokens, cache_creation_tokens, tool_name, cwd, message_id,
564 is_subagent, agent_id)
565 VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
566 """, [
567 (t["session_id"], t["timestamp"], t["model"],
568 t["input_tokens"], t["output_tokens"],
569 t["cache_read_tokens"], t["cache_creation_tokens"],
570 t["tool_name"], t["cwd"], t.get("message_id", ""),
571 t.get("is_subagent", 0), t.get("agent_id"))
572 for t in turns
573 ])
574
575
576def scan(projects_dir=None, projects_dirs=None, db_path=DB_PATH, verbose=True):

Callers 8

setUpMethod · 0.90
setUpMethod · 0.90
setUpMethod · 0.90
setUpMethod · 0.90
setUpMethod · 0.90
test_insert_turnsMethod · 0.90
scanFunction · 0.85

Calls

no outgoing calls

Tested by 7

setUpMethod · 0.72
setUpMethod · 0.72
setUpMethod · 0.72
setUpMethod · 0.72
setUpMethod · 0.72
test_insert_turnsMethod · 0.72