-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.py
More file actions
27 lines (22 loc) · 988 Bytes
/
database.py
File metadata and controls
27 lines (22 loc) · 988 Bytes
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
# Day 6: Database setup. One file, simple.
from sqlalchemy import create_engine, Column, String, Integer, Text, DateTime
from sqlalchemy.orm import sessionmaker, declarative_base
from datetime import datetime
# Create SQLite database (saved as a file)
engine = create_engine("sqlite:///interviews.db")
SessionLocal = sessionmaker(bind=engine)
Base = declarative_base()
# ─── Define the Interview table ───
class Interview(Base):
__tablename__ = "interviews"
id = Column(String, primary_key=True) # Session UUID
name = Column(String)
position = Column(String)
company = Column(String)
level = Column(String)
messages = Column(Text) # JSON string of chat history
feedback = Column(Text, nullable=True) # Feedback (filled later)
score = Column(Integer, nullable=True) # Score 1-10 (filled later)
created_at = Column(DateTime, default=datetime.utcnow)
# Create the table
Base.metadata.create_all(engine)