chore: Move ID generation logic out of the ORM layer and into the Pydantic model layer (#1981)

This commit is contained in:
Matthew Zhou
2024-11-05 17:05:10 -08:00
committed by GitHub
parent b9f772f196
commit b3f86fe4cd
29 changed files with 270 additions and 380 deletions

View File

@@ -1,5 +1,6 @@
from typing import TYPE_CHECKING, List
from sqlalchemy import String
from sqlalchemy.orm import Mapped, mapped_column, relationship
from letta.orm.sqlalchemy_base import SqlalchemyBase
@@ -14,9 +15,10 @@ if TYPE_CHECKING:
class Organization(SqlalchemyBase):
"""The highest level of the object tree. All Entities belong to one and only one Organization."""
__tablename__ = "organization"
__tablename__ = "organizations"
__pydantic_model__ = PydanticOrganization
id: Mapped[str] = mapped_column(String, primary_key=True)
name: Mapped[str] = mapped_column(doc="The display name of the organization.")
users: Mapped[List["User"]] = relationship("User", back_populates="organization", cascade="all, delete-orphan")