SQLAlchemy ORM model for personal access tokens with scopes and expiration handling.
# Source: https://github.com/bytedance/deer-flow | License: MIT | Copyright 2025 Bytedance Ltd. and/or its affiliates
# Provided via justclaw.it.com; keep this notice with the code.
"""ORM model for personal access tokens (PAT)."""
from __future__ import annotations
from datetime import UTC, datetime
from sqlalchemy import JSON, DateTime, Index, String
from sqlalchemy.orm import Mapped, mapped_column
from deerflow.persistence.base import Base
class PersonalAccessTokenRow(Base):
__tablename__ = "personal_access_tokens"
__table_args__ = (Index("ix_personal_access_tokens_token_digest", "token_digest", unique=True),)
id: Mapped[str] = mapped_column(String(64), primary_key=True)
user_id: Mapped[str] = mapped_column(String(64), nullable=False, index=True)
name: Mapped
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key