Spaces:
Running
Running
File size: 904 Bytes
e47fb69 |
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 |
# init_db.py
import sqlite3
import os
os.makedirs("me", exist_ok=True)
db_path = os.path.join("me", "qa.db")
conn = sqlite3.connect(db_path)
cur = conn.cursor()
cur.execute("""
CREATE TABLE IF NOT EXISTS faq (
id INTEGER PRIMARY KEY AUTOINCREMENT,
question TEXT,
answer TEXT
)
""")
# sample seed data (you can edit)
faq_data = [
("What is Akash's tech stack?", "Akash works with the MERN stack: MongoDB, Express, React, Node.js."),
("What projects has Akash completed?", "Online Marketplace for Local Artisans, Freelance Collaboration Platform, Hotel Reservation System."),
("What is Akash studying?", "MCA at KLN College."),
]
# clear existing sample rows (optional)
cur.execute("DELETE FROM faq")
cur.executemany("INSERT INTO faq (question, answer) VALUES (?, ?)", faq_data)
conn.commit()
conn.close()
print("me/qa.db created and seeded.")
|