Skip to content

underscore_attrs_are_private cannot use #504

Open
@dongfengweixiao

Description

@dongfengweixiao

First Check

  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the SQLModel documentation, with the integrated search.
  • I already searched in Google "How to X in SQLModel" and didn't find any information.
  • I already read and followed all the tutorial in the docs and didn't find an answer.
  • I already checked if it is not related to SQLModel but to Pydantic.
  • I already checked if it is not related to SQLModel but to SQLAlchemy.

Commit to Help

  • I commit to help with one of those options 👆

Example Code

from sqlmodel import SQLModel


class UserBase(SQLModel):
    first_name: str
    last_name: str


class UserSchema(UserBase):
    class Config:
        underscore_attrs_are_private = True


if __name__ == "__main__":
    print("Hello world!")

Description

File "c:\Users\dongf\Source\Python\test\main.py", line 9, in
class UserSchema(UserBase):
File "C:\Users\dongf\Source\Python\test\venv\Lib\site-packages\sqlmodel\main.py", line 272, in new
new_cls = super().new(cls, name, bases, dict_used, **config_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "pydantic\main.py", line 283, in pydantic.main.ModelMetaclass.new
File "", line 106, in new
TypeError: weakref slot disallowed: either we already got one, or itemsize != 0

Operating System

Windows

Operating System Details

No response

SQLModel Version

0.0.8

Python Version

Python 3.11.0, Python 3.9.0

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions