MCPcopy Index your code
hub / github.com/fastapi/sqlmodel / __setattr__

Method __setattr__

sqlmodel/main.py:846–857  ·  view source on GitHub ↗
(self, name: str, value: Any)

Source from the content-addressed store, hash-verified

844 sqlmodel_init(self=__pydantic_self__, data=data)
845
846 def __setattr__(self, name: str, value: Any) -> None:
847 if name in {"_sa_instance_state"}:
848 self.__dict__[name] = value
849 return
850 else:
851 # Set in SQLAlchemy, before Pydantic to trigger events and updates
852 if is_table_model_class(self.__class__) and is_instrumented(self, name):
853 set_attribute(self, name, value)
854 # Set in Pydantic model to trigger possible validation changes, only for
855 # non relationship values
856 if name not in self.__sqlmodel_relationships__:
857 super().__setattr__(name, value)
858
859 def __repr_args__(self) -> Sequence[tuple[str | None, Any]]:
860 # Don't show SQLAlchemy private attributes

Callers 5

sqlmodel_table_constructFunction · 0.45
sqlmodel_validateFunction · 0.45
sqlmodel_initFunction · 0.45
__setattr__Method · 0.45

Calls 1

is_table_model_classFunction · 0.85

Tested by

no test coverage detected