`exclude` in Meta breaks with marshmallow 3
See original GitHub issueWe have a pattern where we exclude some relations from the marshmallow schema like this:
class CustomerSchema(MyBaseSchema):
class Meta(MyBaseSchema.Meta):
model = Customer
exclude = ('orders',)
Where Customer
is a sqlalchemy model and orders
is a relation from another table.
This works fine with marshmallow 2.x, but with marshmallow 3, an exception is thrown in the instantiation of CustomerSchema
because marshmallow-sqlalchemy did not create the orders
field, and so orders
doesn’t exist to be excluded.
See also https://github.com/marshmallow-code/marshmallow/issues/877
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Upgrading to Newer Releases — marshmallow 3.19.0 ...
The marshmallow 3.x series supports Python >= 3.5. ... Int() class Meta: # Pass EXCLUDE as Meta option to keep marshmallow 2 behavior...
Read more >Inheriting "exclude" meta parameter from super schema ...
I've found a solution that does work. from marshmallow import fields from marshmallow.schema import Schema class AncestorSchema(Schema): a = ...
Read more >marshmallow - Read the Docs
You can also exclude fields by passing in the exclude parameter. ... The class Meta paradigm allows you to specify which attributes you...
Read more >Python marshmallow Explained [Practical Examples]
In this tutorial, we will learn about the Python marshmallow library in detail. We will learn about marshmallow schema, form validation, and marshmallow...
Read more >python-marshmallow-3.5.1-bp152.1.4 - SUSE Package Hub -
Fix bug where nested fields in Meta.exclude would not work on multiple ... for functions in ``marshmallow.utils`` that are removed in marshmallow 3....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, dependent builds would be a nice feature in Travis. Shame that it’s not on the roadmap.
Nice work finding that test @deckar01 .
I won’t have time to look into this bug this week. @deckar01 or @yaheath would you be up for sending a PR?
The bugfix is released in 0.14.1.