harbor run -t swe-rebench/marshmallow-code__marshmallow-sqlalchemy-645
harbor download swe-rebench/marshmallow-code__marshmallow-sqlalchemy-645
field_for() converter for Relationships not detecting nullable=False Hi, I had a case where I had the following (this is example code):
class Book: ... author_id = Column(Integer, ForeignKey('author.id'), nullable=False) author = relationship('Author', lazy='selectin')
And when I tried to do an author = auto_field() here on 'author' relationship - it gave me an error. i dug into it, and I found the following:
author = auto_field()
from marshmallow_sqlalchemy.convert import default_converter rel = Book.__mapper__.get_property('author') rel_kwargs = {} default_converter._add_relationship_kwargs(rel_kwargs, rel) print(rel_kwargs) # Output: {'allow_none': True, 'required': False} col = Book.__mapper__.get_property('author_id').columns[0] col_kwargs = {} default_converter._add_column_kwargs(col_kwargs, col) print(col_kwargs) # Output: {'required': True}
This got me confused ... cause it looks like :
required=True