Skip to content

Conversation

@pyup-bot
Copy link
Collaborator

This PR updates marshmallow-sqlalchemy from 0.21.0 to 0.22.1.

Changelog

0.22.1

+++++++++++++++++++

Bug fixes:

* Fix behavior when passing ``table`` to ``auto_field`` (:pr:`277`).

0.22.0

+++++++++++++++++++

Features:

* Add ``SQLAlchemySchema`` and ``SQLAlchemyAutoSchema``,
which have an improved API for generating marshmallow fields
and overriding their arguments via ``auto_field`` (:issue:`240`).
Thanks :user:`taion` for the idea and original implementation.

.. code-block:: python

  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_instance`` option to configure deserialization to model instances (:issue:`193`, :issue:`270`).
* Add ``include_relationships`` option to configure generation of marshmallow fields for relationship properties (:issue:`98`).
Thanks :user:`dusktreader` for the suggestion.

Deprecations:

* ``ModelSchema`` and ``TableSchema`` are deprecated,
since ``SQLAlchemyAutoSchema`` has equivalent functionality.

.. code-block:: python

  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
the ``auto_field`` functionality.

Other changes:

* *Backwards-incompatible*: ``fields_for_model`` does not include relationships by default.
Use ``fields_for_model(..., include_relationships=True)`` to preserve the old behavior.
Links

@coveralls
Copy link

Pull Request Test Coverage Report for Build 550

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 71.739%

Totals Coverage Status
Change from base Build 535: 0.0%
Covered Lines: 99
Relevant Lines: 138

💛 - Coveralls

@pyup-bot
Copy link
Collaborator Author

Closing this in favor of #119

@pyup-bot pyup-bot closed this Feb 10, 2020
@avara1986 avara1986 deleted the pyup-update-marshmallow-sqlalchemy-0.21.0-to-0.22.1 branch February 10, 2020 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants