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

Method __new__

sqlmodel/main.py:816–824  ·  view source on GitHub ↗
(cls, *args: Any, **kwargs: Any)

Source from the content-addressed store, hash-verified

814 # Typing spec says `__new__` returning `Any` overrides normal constructor
815 # behavior, but a missing annotation does not:
816 def __new__(cls, *args: Any, **kwargs: Any): # type: ignore[no-untyped-def]
817 new_object = super().__new__(cls)
818 # SQLAlchemy doesn't call __init__ on the base class when querying from DB
819 # Ref: https://docs.sqlalchemy.org/en/14/orm/constructors.html
820 # Set __fields_set__ here, that would have been set when calling __init__
821 # in the Pydantic model so that when SQLAlchemy sets attributes that are
822 # added (e.g. when querying from DB) to the __fields_set__, this already exists
823 init_pydantic_private_attrs(new_object)
824 return new_object
825
826 def __init__(__pydantic_self__, **data: Any) -> None:
827 # Uses something other than `self` the first arg to allow "self" as a

Callers 2

sqlmodel_validateFunction · 0.45
__new__Method · 0.45

Calls 1

Tested by

no test coverage detected