Changelog¶
1.5.0 (2026-04-01)¶
Bug fixes:
Fix memory usage regression from 1.4.1 (1.4.2 didn’t address the root cause) (#665).
Other changes:
Drop support for Python 3.9, which is EOL. Support Python 3.10-3.14.
1.4.2 (2025-04-09)¶
Bug fixes:
Fix memory usage regression in 1.4.1 (#665). Thanks @mistercrunch for reporting and sending a PR.
1.4.1 (2025-02-10)¶
Bug fixes:
1.4.0 (2025-01-19)¶
Bug fixes:
Fix handling of arrays of enums and multidimensional arrays (#653). Thanks @carterjc for reporting and investigating the fix.
Fix handling of
sqlalchemy.PickleTypecolumns (#394) Thanks @Eyon42 for reporting.
Other changes:
Passing arbitrary keyword arguments to
auto_fieldis no longer supported (#647). Use themetadataargument to pass metadata to the generated field instead.
# Before
auto_field(description="The name of the artist")
# On marshmallow 3, this raises a warning: "RemovedInMarshmallow4Warning: Passing field metadata as keyword arguments is deprecated."
# On marshmallow 4, this raises an error: "TypeError: Field.__init__() got an unexpected keyword argument 'description'"
# After
auto_field(metadata=dict(description="The name of the artist"))
1.3.0 (2025-01-11)¶
Features:
Typing: Add type annotations to
fields.
Bug fixes:
Fix auto-generation of
marshmallow.fields.Enumfield fromsqlalchemy.Enumcolumns (#615). Thanks @joaquimvl for reporting.Fix behavior of
include_fk = Falsein options when parent schema setsinclude_fk = True(#440). Thanks @uhnomoli for reporting.Fields generated from non-nullable
sqlalchemy.orm.relationshipcorrectly setrequired=Trueandallow_none=False(#336, #163). Thanks @AbdealiLoKo for reporting.
Other changes:
Docs: Add more documentation for
marshmallow_sqlalchemy.fields.Related(#162). Thanks @GabrielC101 for the suggestion.Docs: Document methods of
SQLAlchemySchemaandSQLAlchemyAutoSchema(#619).Docs: Various documentation improvements (#635, #636, #639, #641, #642).
1.2.0 (2025-01-09)¶
Features:
Other changes:
Drop support for Python 3.8, which is EOL. Support Python 3.9-3.13.
1.1.1 (2025-01-06)¶
Bug fixes:
Fix compatibility with marshmallow 3.24.0 and 4.0.0 (#628).
Other changes:
Test against Python 3.13 (#629).
1.1.0 (2024-08-14)¶
Features:
sqlalchemy.Enumfields generate a correspondingmarshmallow.fields.Enumfield (#485, #112). Thanks @panda-byte for the PR.
Support:
Drop support for marshmallow<3.18.0.
1.0.0 (2024-01-30)¶
Remove
__version__attribute. Use feature detection orimportlib.metadata.version("marshmallow-sqlalchemy")instead (#568).Support marshmallow>=3.10.0 (#566).
Passing
info={"marshmallow": ...}to SQLAlchemy columns is removed, as it is redundant with theauto_fieldfunctionality (#567).Remove
packagingas a dependency (#566).Support Python 3.12.
0.30.0 (2024-01-07)¶
Features:
Use
Session.get()load instances to improve deserialization performance (#548). Thanks @zippolyte for the PR.
Other changes:
Drop support for Python 3.7, which is EOL (#540).
0.29.0 (2023-02-27)¶
Features:
Support SQLAlchemy 2.0 (#494). Thanks @dependabot for the PR.
Enable (in tests) and fix SQLAlchemy 2.0 compatibility warnings (#493).
Bug fixes:
Use mapper
.attrsrather than.get_propertyand.iterate_propertiesto ensureregistry.configureis called (call removed in SQLAlchemy 2.0.2) (#487). Thanks @ddoyon92 for the PR.
Other changes:
Drop support for SQLAlchemy 1.3, which is EOL (#493).
0.28.2 (2023-02-23)¶
Bug fixes:
Use .scalar_subquery() for SQLAlchemy>1.4 to suppress a warning (#459). Thanks @indiVar0508 for the PR.
Other changes:
0.28.1 (2022-07-18)¶
Bug fixes:
0.28.0 (2022-03-09)¶
Features:
Other changes:
Drop support for Python 3.6, which is EOL.
Drop support for SQLAlchemy 1.2, which is EOL.
0.27.0 (2021-12-18)¶
Features:
Distribute type information per PEP 561 (#420). Thanks @bruceadams for the PR.
Other changes:
Test against Python 3.10 (#421).
0.26.1 (2021-06-05)¶
Bug fixes:
Fix generating fields for
postgreql.ARRAYcolumns (#392). Thanks @mjpieters for the catch and patch.
0.26.0 (2021-05-26)¶
Bug fixes:
Unwrap proxied columns to handle models for subqueries (#383). Thanks @mjpieters for the catch and patch
Fix setting
transienton a per-instance basis when thetransientMeta option is set (#388). Thanks again @mjpieters.
Other changes:
Backwards-incompatible: Remove deprecated
ModelSchemaandTableSchemaclasses.
0.25.0 (2021-05-02)¶
Add
load_instanceas a parameter toSQLAlchemySchemaandSQLAlchemyAutoSchema(#380). Thanks @mjpieters for the PR.
0.24.3 (2021-04-26)¶
Fix deprecation warnings from marshmallow 3.10 and SQLAlchemy 1.4 (#369). Thanks @peterschutt for the PR.
0.24.2 (2021-02-07)¶
auto_fieldsupportsassociation_proxyfields with local multiplicity (uselist=True) (#364). Thanks @Unix-Code for the catch and patch.
0.24.1 (2020-11-20)¶
auto_fieldworks withassociation_proxy(#338). Thanks @AbdealiJK.
0.24.0 (2020-10-20)¶
Backwards-incompatible: Drop support for marshmallow 2.x, which is now EOL.
Test against Python 3.9.
0.23.1 (2020-05-30)¶
Bug fixes:
0.23.0 (2020-04-26)¶
Bug fixes:
Fix data keys when using
Relatedwith aColumnthat is named differently from its attribute (#299). Thanks @peterschutt for the catch and patch.Fix bug that raised an exception when using the
ordered = Trueoption on a schema that has anauto_field(#306). Thanks @KwonL for reporting and thanks @peterschutt for the PR.
0.22.3 (2020-03-01)¶
Bug fixes:
Fix
DeprecationWarninggetting raised even when user code does not useTableSchemaorModelSchema(#289). Thanks @5uper5hoot for reporting.
0.22.2 (2020-02-09)¶
Bug fixes:
Avoid error when using
SQLAlchemyAutoSchema,ModelSchema, orfields_for_modelwith a model that has aSynonymProperty(#190). Thanks @TrilceAC for reporting.auto_fieldandfield_forwork withSynonymProperty(#280).
Other changes:
Add hook in
ModelConverterfor changing field names based on SQLA columns and properties (#276). Thanks @davenquinn for the suggestion and the PR.
0.22.1 (2020-02-09)¶
Bug fixes:
Fix behavior when passing
tabletoauto_field(#277).
0.22.0 (2020-02-09)¶
Features:
Add
SQLAlchemySchemaandSQLAlchemyAutoSchema, which have an improved API for generating marshmallow fields and overriding their arguments viaauto_field(#240). Thanks @taion for the idea and original implementation.
# Before
from marshmallow_sqlalchemy import ModelSchema, field_for
from . import models
class ArtistSchema(ModelSchema):
class Meta:
model = models.Artist
id = field_for(models.Artist, "id", dump_only=True)
created_at = field_for(models.Artist, "created_at", dump_only=True)
# After
from marshmallow_sqlalchemy import SQLAlchemySchema, auto_field
from . import models
class ArtistSchema(SQLAlchemyAutoSchema):
class Meta:
model = models.Artist
id = auto_field(dump_only=True)
created_at = auto_field(dump_only=True)
Add
load_instanceoption to configure deserialization to model instances (#193, #270).Add
include_relationshipsoption to configure generation of marshmallow fields for relationship properties (#98). Thanks @dusktreader for the suggestion.
Deprecations:
ModelSchemaandTableSchemaare deprecated, sinceSQLAlchemyAutoSchemahas equivalent functionality.
# Before
from marshmallow_sqlalchemy import ModelSchema, TableSchema
from . import models
class ArtistSchema(ModelSchema):
class Meta:
model = models.Artist
class AlbumSchema(TableSchema):
class Meta:
table = models.Album.__table__
# After
from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
from . import models
class ArtistSchema(SQLAlchemyAutoSchema):
class Meta:
model = models.Artist
include_relationships = True
load_instance = True
class AlbumSchema(SQLAlchemyAutoSchema):
class Meta:
table = models.Album.__table__
Passing
info={"marshmallow": ...}to SQLAlchemy columns is deprecated, as it is redundant with theauto_fieldfunctionality.
Other changes:
Backwards-incompatible:
fields_for_modeldoes not include relationships by default. Usefields_for_model(..., include_relationships=True)to preserve the old behavior.
0.21.0 (2019-12-04)¶
Add support for
postgresql.OIDtype (#262). Thanks @petrus-v for the PR.Remove imprecise Python 3 classifier from PyPI metadata (#255). Thanks @ecederstrand.
0.20.0 (2019-12-01)¶
Add support for
mysql.DATETIMEandmysql.INTEGERtype (#204).Add support for
postgresql.CIDRtype (#183).Add support for
postgresql.DATEandpostgresql.TIMEtype.
Thanks @evelyn9191 for the PR.
0.19.0 (2019-09-05)¶
Drop support for Python 2.7 and 3.5 (#241).
Drop support for marshmallow<2.15.2.
Only support sqlalchemy>=1.2.0.
0.18.0 (2019-09-05)¶
Features:
marshmallow_sqlalchemy.fields.Nestedpropagates the value oftransienton the call toload(#177, #206). Thanks @leonidumanskiy for reporting.
Note: This is the last release to support Python 2.7 and 3.5.
0.17.2 (2019-08-31)¶
Bug fixes:
0.17.1 (2019-08-31)¶
Bug fixes:
Add
marshmallow_sqlalchemy.fields.Nestedfield that inherits its session from its schema. This fixes a bug where an exception was raised when usingNestedwithin aModelSchema(#67). Thanks @nickw444 for reporting and thanks @samueljsb for the PR.
User code should be updated to use marshmallow-sqlalchemy’s Nested instead of marshmallow.fields.Nested.
# Before
from marshmallow import fields
from marshmallow_sqlalchemy import ModelSchema
class ArtistSchema(ModelSchema):
class Meta:
model = models.Artist
class AlbumSchema(ModelSchema):
class Meta:
model = models.Album
artist = fields.Nested(ArtistSchema)
# After
from marshmallow import fields
from marshmallow_sqlalchemy import ModelSchema
from marshmallow_sqlalchemy.fields import Nested
class ArtistSchema(ModelSchema):
class Meta:
model = models.Artist
class AlbumSchema(ModelSchema):
class Meta:
model = models.Album
artist = Nested(ArtistSchema)
0.17.0 (2019-06-22)¶
Features:
0.16.4 (2019-06-15)¶
Bug fixes:
Compatibility with marshmallow 3.0.0rc7. Thanks @heckad for the catch and patch.
0.16.3 (2019-05-05)¶
Bug fixes:
Compatibility with marshmallow 3.0.0rc6.
0.16.2 (2019-04-10)¶
Bug fixes:
Prevent ValueError when using the
excludeclass Meta option withTableSchema(#202).
0.16.1 (2019-03-11)¶
Bug fixes:
Fix compatibility with SQLAlchemy 1.3 (#185).
0.16.0 (2019-02-03)¶
Features:
Add support for deserializing transient objects (#62). Thanks @jacksmith15 for the PR.
0.15.0 (2018-11-05)¶
Features:
Add
ModelConverter._should_exclude_fieldhook (#139). Thanks @jeanphix for the PR.Allow field
kwargsto be overriden by passinginfo['marshmallow']to column properties (#21). Thanks @dpwrussell for the suggestion and PR. Thanks @jeanphix for the final implementation.
0.14.2 (2018-11-03)¶
Bug fixes:
Fix behavior of
Relatedfield (#150). Thanks @zezic for reporting and thanks @AbdealiJK for the PR.Relatednow works withAssociationProxyfields (#151). Thanks @AbdealiJK for the catch and patch.
Other changes:
Test against Python 3.7.
Bring development environment in line with marshmallow.
0.14.1 (2018-07-19)¶
Bug fixes:
0.14.0 (2018-05-28)¶
Features:
Make
ModelSchema.sessiona property, which allows session to be retrieved fromcontext(#129). Thanks @gtxm.
Other changes:
Drop official support for Python 3.4. Python>=3.5 and Python 2.7 are supported.
0.13.2 (2017-10-23)¶
Bug fixes:
0.13.1 (2017-04-06)¶
Bug fixes:
0.13.0 (2017-03-12)¶
Features:
Invalid inputs for compound primary keys raise a
ValidationErrorwhen deserializing a scalar value (#103). Thanks @YuriHeupa for the PR.
Bug fixes:
Fix compatibility with marshmallow>=3.x.
0.12.1 (2017-01-05)¶
Bug fixes:
Reset
ModelSchema.instanceafter eachloadcall, allowing schema instances to be reused (#78). Thanks @georgexsh for reporting.
Other changes:
Test against Python 3.6.
0.12.0 (2016-10-08)¶
Features:
Bug fixes:
Fix bug that caused a validation errors for custom column types that have the
python_typeofuuid.UUID(#54). Thanks @wkevina and thanks @kelvinhammond for the fix.
Other changes:
Drop official support for Python 3.3. Python>=3.4 and Python 2.7 are supported.
0.11.0 (2016-10-01)¶
Features:
Allow overriding field class returned by
field_forby adding thefield_classparam (#81). Thanks @cancan101.
0.10.0 (2016-08-14)¶
Features:
0.9.0 (2016-07-02)¶
Features:
Enable deserialization of many-to-one nested objects that do not exist in the database (#69). Thanks @seanharr11 for the PR.
Bug fixes:
0.8.1 (2016-02-21)¶
Bug fixes:
ModelSchemaandTableSchemarespect field order if theordered=Trueclass Meta option is set (#52). Thanks @jeffwidman for reporting and @jmcarp for the patch.Declared fields are not introspected in order to support, e.g.
column_property(#57). Thanks @jmcarp.
0.8.0 (2015-12-28)¶
Features:
0.7.1 (2015-12-13)¶
Bug fixes:
Don’t make marshmallow fields required for non-nullable columns if a column has a default value or autoincrements (#47). Thanks @jmcarp for the fix. Thanks @AdrielVelazquez for reporting.
0.7.0 (2015-12-07)¶
Features:
Non-nullable columns will generated required marshmallow Fields (#40). Thanks @jmcarp.
Improve support for MySQL BIT field (#41). Thanks @rudaporto.
Backwards-incompatible: Remove
fields.get_primary_columnsin favor offields.get_primary_keys.Backwards-incompatible: Remove
Related.related_columnsin favor offields.related_keys.
Bug fixes:
0.6.0 (2015-09-29)¶
Features:
Support for compound primary keys. Thanks @jmcarp.
Other changes:
Supports marshmallow>=2.0.0.
0.5.0 (2015-09-27)¶
Add
instanceargument toModelSchemaconstructor andModelSchema.loadwhich allows for updating existing DB rows (#26). Thanks @sssilver for reporting and @jmcarp for the patch.Don’t autogenerate fields that are in
Meta.exclude(#27). Thanks @jmcarp.Raise
ModelConversionErrorif converting properties whose column don’t define apython_type. Thanks @jmcarp.Backwards-incompatible:
ModelSchema.make_objectis removed in favor of decoratedmake_instancemethod for compatibility with marshmallow>=2.0.0rc2.
0.4.1 (2015-09-13)¶
Bug fixes:
0.4.0 (2015-09-03)¶
Features:
Bug fixes:
Allow
sessionto be passed toModelSchema.validate, since it requires it. Thanks @dpwrussell.When serializing, don’t skip overriden fields that are part of a polymorphic hierarchy (#18). Thanks again @dpwrussell.
Support:
Docs: Add new recipe for automatic generation of schemas. Thanks @dpwrussell.
0.3.0 (2015-08-27)¶
Features:
Backwards-incompatible: Relationships are (de)serialized by a new, more efficient
Relatedcolumn (#7). Thanks @jmcarp.Improve support for MySQL types (#1). Thanks @rmackinnon.
Improve support for Postgres ARRAY types (#6). Thanks @jmcarp.
ModelSchemano longer requires thesqla_sessionclass Meta option. ASessioncan be passed to the constructor or to theModelSchema.loadmethod (#11). Thanks @dtheodor for the suggestion.
Bug fixes:
Null foreign keys are serialized correctly as
None(#8). Thanks @mitchej123.Properly handle a relationship specifies
uselist=False(#17). Thanks @dpwrussell.
0.2.0 (2015-05-03)¶
Features:
Add
field_forfunction for generating marshmallow Fields from SQLAlchemy mapped class properties.
Support:
Docs: Add “Overriding generated fields” section to “Recipes”.
0.1.1 (2015-05-02)¶
Bug fixes:
Fix
keygetterclass Meta option.
0.1.0 (2015-04-28)¶
First release.