The FlowListRead schema is added to support reading a list of flows with their styles. The SQLModelSerializable base model is added to support serialization of SQLModel objects to JSON using orjson. This improves performance and reduces memory usage. 🐛 fix(flow.py): add optional style relationship to Flow model The style relationship is now optional to allow for flows without styles. This is achieved by setting the uselist parameter of the sa_relationship_kwargs to False. ✨ feat(flow.py): add FlowReadWithStyle and FlowUpdate models The FlowReadWithStyle model is added to support reading a flow with its style. The FlowUpdate model is added to support updating a flow.
14 lines
363 B
Python
14 lines
363 B
Python
from sqlmodel import SQLModel
|
|
import orjson
|
|
|
|
|
|
def orjson_dumps(v, *, default):
|
|
# orjson.dumps returns bytes, to match standard json.dumps we need to decode
|
|
return orjson.dumps(v, default=default).decode()
|
|
|
|
|
|
class SQLModelSerializable(SQLModel):
|
|
class Config:
|
|
orm_mode = True
|
|
json_loads = orjson.loads
|
|
json_dumps = orjson_dumps
|