diff --git a/fquery/sqlmodel.py b/fquery/sqlmodel.py index 0bc2c67..93a102b 100644 --- a/fquery/sqlmodel.py +++ b/fquery/sqlmodel.py @@ -44,7 +44,8 @@ def model(table: bool = True, table_name: str = None, global_id: bool = False): """ def sqlmodel(self) -> SQLModel: - return self.__sqlmodel__(**self.__dict__) + attrs = {name: getattr(self, name) for name in self.__sqlmodel__.__fields__} + return self.__sqlmodel__(**attrs) def decorator(cls): # Check if the class is a dataclass