🐛 Fix SQLAlchemy version 1.4.36 breaks SQLModel relationships (#315) (#461)

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
byrman
2023-10-22 14:01:51 +02:00
committed by GitHub
parent aa7169b93b
commit d5219aa3c5
2 changed files with 38 additions and 2 deletions

View File

@ -333,6 +333,7 @@ class SQLModelMetaclass(ModelMetaclass, DeclarativeMeta):
# There's a SQLAlchemy relationship declared, that takes precedence
# over anything else, use that and continue with the next attribute
dict_used[rel_name] = rel_info.sa_relationship
setattr(cls, rel_name, rel_info.sa_relationship) # Fix #315
continue
ann = cls.__annotations__[rel_name]
temp_field = ModelField.infer(