INNER CODE UNIT · Python

to_dict

c0sogi/LLMChat · app/database/schemas/__init__.py:26

    def to_dict(self, *args, exclude: list | None = None):
        q_dict: dict = {}
        for c in self.__table__.columns:  # type: ignore
            if not args or c.name in args:
                if not exclude or c.name not in exclude:
                    q_dict[c.name] = getattr(self, c.name)
        return q_dict

    @property
    def columns(self) -> list[Column]:
        return [
            col
            for col in self.__table__.columns  # type: ignore
            if (not col.primary_key) and (col.name != "created_at")
        ]

    @classmethod
    async def add_all(

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…