-
-
Notifications
You must be signed in to change notification settings - Fork 748
Open
Labels
questionFurther information is requestedFurther information is requested
Description
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 typing import Optional
from uuid import UUID
from pydantic import AnyHttpUrl, EmailStr
from pydantic.color import Color
from sqlalchemy import Column, Enum
from sqlmodel import SQLModel, Field, AutoString
from app.schemas.base_model import BaseSchema
from app.schemas.enums import UserType, UserGender, UserScrapeFrom
class UserBase(SQLModel):
type: UserType
en_name: Optional[str] = Field(index=True)
ar_name: Optional[str] = Field(index=True)
email: Optional[EmailStr] = Field(default=None)
uot_url: Optional[AnyHttpUrl] = Field(default=None)
image: Optional[AnyHttpUrl] = Field(default=None)
color: Color = Field(sa_column=Column(AutoString()))
asc_job_title: str = Field()
asc_name: str = Field()
scrape_from: Optional[UserScrapeFrom] = Field(default=None)
gender: UserGender = Field(sa_column=Column(Enum(UserGender)))
# relations
role_id: Optional[UUID] = Field(foreign_key="role.id")
Description
Create a type that does not belong to sqlalchemy
color: Color = Field(sa_column=Column(AutoString()))
throw error in migration
alembic migration line
sa.Column('color', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
Operating System
Windows
Operating System Details
No response
SQLModel Version
0.0.6
Python Version
Python 3.9.7
Additional Context
No response
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested