node_artifact.py 1.0 KB

123456789101112131415161718192021
  1. from sqlalchemy import Integer, String, Text
  2. from sqlalchemy.dialects.sqlite import JSON
  3. from sqlalchemy.orm import Mapped, mapped_column
  4. from core_db import AuditMixin, Base, TenantMixin, VersionMixin
  5. from core_shared import JSONValue
  6. class NodeArtifact(TenantMixin, AuditMixin, VersionMixin, Base):
  7. __tablename__ = "node_artifact"
  8. run_id: Mapped[str] = mapped_column(String(36), index=True)
  9. node_run_id: Mapped[str] = mapped_column(String(36), index=True)
  10. node_id: Mapped[str] = mapped_column(String(128), index=True)
  11. artifact_type: Mapped[str] = mapped_column(String(64), index=True)
  12. name: Mapped[str] = mapped_column(String(128))
  13. mime_type: Mapped[str | None] = mapped_column(String(128), nullable=True)
  14. content_text: Mapped[str | None] = mapped_column(Text, nullable=True)
  15. content_json: Mapped[dict[str, JSONValue] | None] = mapped_column(JSON, nullable=True)
  16. storage_uri: Mapped[str | None] = mapped_column(String(512), nullable=True)
  17. size_bytes: Mapped[int | None] = mapped_column(Integer, nullable=True)