Objects API#

fastapi_restly.objects.apply_schema(session: Session, obj: _T, schema_obj: BaseModel, schema_cls: type[BaseModel] | None = None) _T#

Apply writable fields from schema_obj to obj.

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 view-level perform_update business logic.

async fastapi_restly.objects.async_apply_schema(session: AsyncSession, obj: _T, schema_obj: BaseModel, schema_cls: type[BaseModel] | None = None) _T#

Async equivalent of apply_schema().

async fastapi_restly.objects.async_build_from_schema(session: AsyncSession, model_cls: type[_T], schema_obj: BaseModel, schema_cls: type[BaseModel] | None = None) _T#

Async equivalent of build_from_schema().

async fastapi_restly.objects.async_delete_object(session: AsyncSession, obj: DeclarativeBase) None#

Async equivalent of delete_object().

async fastapi_restly.objects.async_save_object(session: AsyncSession, obj: _T) _T#

Async equivalent of save_object().

fastapi_restly.objects.build_from_schema(session: Session, model_cls: type[_T], schema_obj: BaseModel, schema_cls: type[BaseModel] | None = None) _T#

Build model_cls from schema_obj and add it to session.

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 view-level perform_create business logic.

fastapi_restly.objects.delete_object(session: Session, obj: DeclarativeBase) None#

Delete obj and flush the session.

fastapi_restly.objects.save_object(session: Session, obj: _T) _T#

Flush the session and refresh obj from the database.