Objects API#
- async fastapi_restly.objects.async_delete_object(session: AsyncSession, obj: DeclarativeBase) None#
Async equivalent of
delete_object().
- async fastapi_restly.objects.async_make_new_object(session: AsyncSession, model_cls: type[_T], schema_obj: BaseModel, schema_cls: type[BaseModel] | None = None) _T#
Async equivalent of
make_new_object().
- async fastapi_restly.objects.async_save_object(session: AsyncSession, obj: _T) _T#
Async equivalent of
save_object().
- async fastapi_restly.objects.async_update_object(session: AsyncSession, obj: _T, schema_obj: BaseModel, schema_cls: type[BaseModel] | None = None) _T#
Async equivalent of
update_object().
- fastapi_restly.objects.delete_object(session: Session, obj: DeclarativeBase) None#
Delete
objand flush the session.
- fastapi_restly.objects.make_new_object(session: Session, model_cls: type[_T], schema_obj: BaseModel, schema_cls: type[BaseModel] | None = None) _T#
Build
model_clsfromschema_objand add it tosession.This is the schema-to-ORM mapping primitive. It resolves Restly reference fields, skips read-only inputs, applies schema defaults, and stages the object in the session. It does not flush and does not run a view’s
createbusiness logic.
- fastapi_restly.objects.save_object(session: Session, obj: _T) _T#
Flush the session and refresh
objfrom the database.
- fastapi_restly.objects.snapshot(obj: DeclarativeBase) dict[str, Any]#
Frozen capture of an object’s already-loaded column values, for old-vs-new dirty detection in the commit hooks.
Not
copy(obj)(which shares SQLAlchemy instance state). Reads only attributes already present on the instance, so it never triggers a lazy load: a deferred/unloaded column is skipped instead of forcing a blocking SELECT (which on an async session would raiseMissingGreenlet). No session argument: it reads state already on the instance.
- fastapi_restly.objects.update_object(session: Session, obj: _T, schema_obj: BaseModel, schema_cls: type[BaseModel] | None = None) _T#
Apply writable fields from
schema_objtoobj.This is the schema-to-ORM update primitive. It resolves Restly reference fields and applies only writable inputs. It does not flush and does not run a view’s
updatebusiness logic.
See also
Override CRUD Behavior and Add Custom Endpoints — the view-bound counterparts and the domain-utilities table.