Files
onyx/backend/danswer/db/utils.py
T

10 lines
245 B
Python

from typing import Any
from sqlalchemy import inspect
from danswer.db.models import Base
def model_to_dict(model: Base) -> dict[str, Any]:
return {c.key: getattr(model, c.key) for c in inspect(model).mapper.column_attrs} # type: ignore