From 67bea0fd1074c74e803373267f6d103c09c4157d Mon Sep 17 00:00:00 2001 From: Michael Bianco Date: Tue, 25 Feb 2025 13:05:00 -0700 Subject: [PATCH] fix: for older versions of py --- sqlmodel/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sqlmodel/main.py b/sqlmodel/main.py index 24fee97579..d377e62d50 100644 --- a/sqlmodel/main.py +++ b/sqlmodel/main.py @@ -642,6 +642,7 @@ def __init__( rel_args.extend(rel_info.sa_relationship_args) if rel_info.sa_relationship_kwargs: rel_kwargs.update(rel_info.sa_relationship_kwargs) + # this where RelationshipInfo objects are converted to lazy column evaluators rel_value = relationship(relationship_to, *rel_args, **rel_kwargs) setattr(cls, rel_name, rel_value) # Fix #315 # SQLAlchemy no longer uses dict_ @@ -722,8 +723,8 @@ def get_column_from_field(field: PydanticFieldInfo | FieldInfo) -> Column: # ty sa_column = getattr(field_info, "sa_column", Undefined) if isinstance(sa_column, Column): # if a db field comment is not already defined, and a description exists on the field, add it to the column definition - if not sa_column.comment and (field_comment := field_info.description): - sa_column.comment = field_comment + if not sa_column.comment and field_info.description: + sa_column.comment = field_info.description return sa_column