mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-03-27 02:02:18 +01:00
10 lines
242 B
Python
10 lines
242 B
Python
from typing import Any
|
|
|
|
from sqlalchemy import inspect
|
|
|
|
from onyx.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
|