30 lines
1.3 KiB
Python
30 lines
1.3 KiB
Python
"""语义事实抽取运行记录。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Optional
|
|
|
|
from sqlalchemy import BigInteger, Integer, Text, VARCHAR
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from .base import Base
|
|
|
|
|
|
class SemanticFactExtractionRun(Base):
|
|
__tablename__ = "semantic_fact_extraction_runs"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
|
entity_type: Mapped[str] = mapped_column(VARCHAR(32), nullable=False, index=True)
|
|
entity_id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True)
|
|
trigger_type: Mapped[str] = mapped_column(VARCHAR(32), nullable=False, default="manual_retry")
|
|
status: Mapped[str] = mapped_column(VARCHAR(32), nullable=False, default="queued", index=True)
|
|
input_fingerprint: Mapped[Optional[str]] = mapped_column(VARCHAR(64), nullable=True, index=True)
|
|
facts_written: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
|
failure_reason: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
|
|
extract_version: Mapped[Optional[str]] = mapped_column(VARCHAR(64), nullable=True)
|
|
started_at: Mapped[Optional[str]] = mapped_column(VARCHAR(64), nullable=True)
|
|
finished_at: Mapped[Optional[str]] = mapped_column(VARCHAR(64), nullable=True)
|
|
|
|
|
|
__all__ = ["SemanticFactExtractionRun"]
|