Spaces:
Sleeping
Sleeping
File size: 1,071 Bytes
99caad5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | from sqlalchemy import String,Integer,JSON
from sqlalchemy.orm import Mapped,mapped_column
from KnowledgeService.models import Base
class Fact(Base):
__tablename__='ctx_fact'
tenant:Mapped[str]=mapped_column(String(80),primary_key=True)
owner:Mapped[str]=mapped_column(String(80),primary_key=True)
workspace:Mapped[str]=mapped_column(String(80),primary_key=True)
key:Mapped[str]=mapped_column(String(120),primary_key=True)
value:Mapped[dict]=mapped_column(JSON)
revision:Mapped[int]=mapped_column(Integer)
updated_at:Mapped[str]=mapped_column(String(40))
class Snapshot(Base):
__tablename__='ctx_snapshot'
id:Mapped[str]=mapped_column(String(80),primary_key=True)
tenant:Mapped[str]=mapped_column(String(80),index=True)
owner:Mapped[str]=mapped_column(String(80),index=True)
workspace:Mapped[str]=mapped_column(String(80),index=True)
fingerprint:Mapped[str]=mapped_column(String(64),index=True)
body:Mapped[dict]=mapped_column(JSON)
created_at:Mapped[str]=mapped_column(String(40))
|