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))