add db
This commit is contained in:
17
models/orm.py
Normal file
17
models/orm.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from sqlalchemy import create_engine, Column, String, Text, Integer
|
||||
from sqlalchemy.orm import declarative_base
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
|
||||
class Prompt(Base):
|
||||
__tablename__ = "prompts"
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
name = Column(String, nullable=False)
|
||||
text = Column(Text, nullable=False)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
engine = create_engine("sqlite:///example.db")
|
||||
Base.metadata.create_all(engine)
|
||||
6
models/validation.py
Normal file
6
models/validation.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Prompt(BaseModel):
|
||||
name: str
|
||||
text: str
|
||||
Reference in New Issue
Block a user