I have the following models/schemas:
class UserBase(SQLModel):
full_name: str
email: EmailStr
is_active: bool = True
is_superuser: bool = False
class UserRead(UserBase):
id: uuid.UUID
class UserCreate(UserBase, extra=Extra.forbid):
password: str
class UserUpdate(UserBase):
password: Optional[str] = None
class User(UserBase, table=True):
id: uuid.UUID = Field(
default_factory=uuid.uuid4,
primary_key=True,
index=True,
nullable=False,
)
hashed_password: Optional[str] = None
In my postgres client the table shows the columns in the order the fields are listed in the models/schemas:
Also, the openapi documentation lists the response object fields in the same order they are specified in the User
model (notice the response object on the bottom of the image):
I would like to have the id
to be the first column/field to show in the table/response object. In general, how can I enforce a specific order of the columns/fields?