-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fast API example fails with PydanticSchemaGenerationError #160
Comments
Installed with exact versions, and the example runs. |
Not sure if this is the correct approach, but solved using this:
|
The fastapi example also did not work for me "out of the box". But adding class PersonBase(SQLModel):
name: str
class Person(PersonBase, table=True):
__tablename__ = "person"
# Allow arbitrary types like File in model
model_config = ConfigDict(arbitrary_types_allowed=True)
image: Union[File, UploadFile, None] = Field(
sa_column=Column(
ImageField(
upload_storage="category",
thumbnail_size=(200, 200),
validators=[SizeValidator(max_size="1M")],
)
)
)
class PersonOut(PersonBase):
image: FileInfo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi and thanks for a great library!
I've tried running the FastAPI example as-is, and I get the following error:
pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for <class 'sqlalchemy_file.file.File'>. Set
arbitrary_types_allowed=True
in the model_config to ignore this error or implement__get_pydantic_core_schema__
on your type to fully support it.The text was updated successfully, but these errors were encountered: