marshmallow-sqlalchemy
marshmallow-sqlalchemy copied to clipboard
SQLAlchemy integration with marshmallow
Hi, I had a case where I had the following (this is example code): ```python class Book: ... author_id = Column(Integer, ForeignKey('author.id'), nullable=False) author = relationship('Author', lazy='selectin') ``` And when...
`marshmallow_sqlalchemy.fields.Related` currently takes a kwarg `column` telling it which columns to use for serialization of an SQLAlchemy relationship data. However, the method documentation speaks of a `columns` parameter (plural). Both...
I use sqlalchemy_utils which provide ChoiceType field (and many others). I'm able to create a new Marshmallow field (Field) to handle this new field with proper `_serialize/_deserialize` functions but instead...
I came across this when migrating some schemas this week. The deprecated `ModelSchema` class has the `load_instance` attribute set `True` by default "for backwards compatibility". https://github.com/marshmallow-code/marshmallow-sqlalchemy/blob/37ded650384756904d8af7af63cbc29c0b5280b7/src/marshmallow_sqlalchemy/schema/model_schema.py#L33 The newer SQLAlchemySchema doesn't...
Having those two objects: ``` class Product(Model): __tablename__: product_table_name id = Column(Integer, primary_key=True) name = Column(String) class BasketItem(Model): __tablename__: basket_item_table_name id = Column(Integer, primary_key=True) product_id = Column( Integer, ForeignKey(f"{product_table_name}.id"), nullable=False...
``` class Test(Model): ... @property def my_user(self): return User.query.filter_by(id=1).first() ``` ``` class TestSchema(ma.SQLAlchemyAutoSchema): class Meta: model = Node include_fk = True unknown = INCLUDE my_user = ma.Nested('UserSchema') ```
I'd like to be able to tell the Related field that it should fail if it can't find an existing parent record. This is for when a user doesn't have...
Feature Request: built-in validator that object already exists in the db (useful for foreign keys)
Some of my API's let people create new objects, and some of the fields are optional foreign keys. Currently when a foreign key gets passed in, I have some custom...
I had a model which looks something like this: ``` import sqlalchemy as sa import marshmallow_sqlalchemy as ma_sqla from sqlalchemy.ext.declarative import declarative_base BaseModel = declarative_base() class BookCategory(BaseModel): __tablename__ = 'book_category'...
Tracking this for 1.0. Also remove `info={'marshmallow': ...}`