File size: 1,044 Bytes
e3754ce | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | import sqlite3
from pathlib import Path
# Path to your taxonomy.sqlite
db_path = Path("mcp_servers/taxonomy_server/data/taxonomy.sqlite")
db_path.parent.mkdir(parents=True, exist_ok=True) # ensure folder exists
# Connect (creates file if not exists)
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
# Create table
cursor.execute("""
CREATE TABLE IF NOT EXISTS taxonomy (
category TEXT PRIMARY KEY,
description TEXT
)
""")
# Insert taxonomy categories
categories = [
("finance.invoice", "Documents related to invoices, payments, and bills."),
("finance.expense_report", "Internal employee expense reports."),
("hr.leave_request", "Requests for leave or time off."),
("hr.policy", "Internal HR policies and guidelines."),
("legal.contract", "Contracts, agreements, and legal documents.")
]
cursor.executemany("INSERT OR REPLACE INTO taxonomy (category, description) VALUES (?, ?)", categories)
conn.commit()
conn.close()
print(f"taxonomy.sqlite populated with {len(categories)} categories at {db_path}")
|