Source: factory.core/ObjDataModel.py
Generic schema-driven CRUD model.
Loads table schema from YAML (models: section), auto-creates the table,
and provides read(), save(), delete(), list(), validate() operations
without requiring subclass implementation.
...
| Method | Signature | Description |
|---|---|---|
| read | read(guid: str) -> bool |
Load a record by GUID. Returns True if found. |
| save | save() -> bool |
Save (insert or update) this record. |
| delete | delete(guid: str) -> bool |
Soft delete by setting Active='N'. |
| list | list(filters: Optional[Dict[str, Any]] = None, active_only: bool = True, limit: int = 0, offset: int = 0) -> List[Dict[str, Any]] |
List records with optional filters. |
| count | count(filters: Optional[Dict[str, Any]] = None, active_only: bool = True) -> int |
Return the number of matching records. |
| exists | exists(guid: str) -> bool |
Check if a record exists without |
| get | get(field: str, default: Any = None) -> Any |
Get a field value. Returns default if not set. |
| set | set(field: str, value: Any) -> None |
Set a field value. |
| from_dict | from_dict(data: Dict[str, Any]) -> Set[str] |
Populate from a dictionary (typically |
| to_dict | to_dict() -> Dict[str, Any] |
Export all field values as a dictionary. |
| last_errors | last_errors() -> List[str] |
Return errors from the last |
| invalidate_cache | invalidate_cache(cls, schema_name: str = '') -> None |
Clear the in-process schema cache. |
| validate | validate() -> List[str] |
Validate all fields according to schema rules. |