Spaces:
Running on T4
Running on T4
Download backend/app/modules/api_audit/models.py from modventures/baseball-engine: direct link, hf CLI and curl.
- Browser
- Download file 1.8 kB
-
https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/backend/app/modules/api_audit/models.py
- Command line
-
hf download hf://spaces/modventures/baseball-engine/backend/app/modules/api_audit/models.py
-
curl -L -o models.py https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/backend/app/modules/api_audit/models.py
1.8 kB
| """One request/response record per backend HTTP call, independent of its transaction.""" | |
| from datetime import datetime | |
| from uuid import UUID | |
| from sqlalchemy import Boolean, DateTime, Float, Index, Integer, String | |
| from sqlalchemy.dialects.postgresql import JSONB | |
| from sqlalchemy.orm import Mapped, mapped_column | |
| from app.common.base_model import Base, CreatedAtMixin, IdMixin | |
| class ApiRequestLog(IdMixin, CreatedAtMixin, Base): | |
| __tablename__ = "api_request_logs" | |
| __table_args__ = (Index("ix_api_request_logs_created_at", "created_at"),) | |
| request_id: Mapped[str] = mapped_column(String(128), index=True) | |
| started_at: Mapped[datetime] = mapped_column(DateTime(timezone=True)) | |
| method: Mapped[str] = mapped_column(String(16)) | |
| path: Mapped[str] = mapped_column(String(2048)) | |
| route: Mapped[str | None] = mapped_column(String(512), index=True) | |
| status_code: Mapped[int] = mapped_column(Integer, index=True) | |
| duration_ms: Mapped[float] = mapped_column(Float) | |
| account_id: Mapped[UUID | None] = mapped_column(index=True) | |
| session_id: Mapped[UUID | None] = mapped_column(index=True) | |
| analysis_id: Mapped[str | None] = mapped_column(String(256), index=True) | |
| analysis_revision: Mapped[int | None] = mapped_column(Integer) | |
| request_headers: Mapped[dict] = mapped_column(JSONB) | |
| query_params: Mapped[dict] = mapped_column(JSONB) | |
| request_payload: Mapped[dict] = mapped_column(JSONB) | |
| response_headers: Mapped[dict] = mapped_column(JSONB) | |
| response_payload: Mapped[dict] = mapped_column(JSONB) | |
| error_code: Mapped[str | None] = mapped_column(String(128)) | |
| exception_type: Mapped[str | None] = mapped_column(String(128)) | |
| response_complete: Mapped[bool] = mapped_column(Boolean) | |
| service_version: Mapped[str] = mapped_column(String(128)) | |