Skip to content

Commit

Permalink
fix: for older versions of py
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveitaly committed Feb 25, 2025
1 parent c615af2 commit 67bea0f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sqlmodel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 67bea0f

Please sign in to comment.