Marshmallow-sqlalchemy

Latest version: v1.1.0

Safety actively analyzes 688674 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 10

0.22.2

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

Bug fixes:

* Avoid error when using ``SQLAlchemyAutoSchema``, ``ModelSchema``, or ``fields_for_model``
with a model that has a ``SynonymProperty`` (:issue:`190`).
Thanks :user:`TrilceAC` for reporting.
* ``auto_field`` and ``field_for`` work with ``SynonymProperty`` (:pr:`280`).

Other changes:

* Add hook in ``ModelConverter`` for changing field names based on SQLA columns and properties (:issue:`276`).
Thanks :user:`davenquinn` for the suggestion and the PR.

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.

0.21.0

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

* Add support for ``postgresql.OID`` type (:pr:`262`).
Thanks :user:`petrus-v` for the PR.
* Remove imprecise Python 3 classifier from PyPI metadata (:pr:`255`).
Thanks :user:`ecederstrand`.

0.20.0

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

* Add support for ``mysql.DATETIME`` and ``mysql.INTEGER`` type (:issue:`204`).
* Add support for ``postgresql.CIDR`` type (:issue:`183`).
* Add support for ``postgresql.DATE`` and ``postgresql.TIME`` type.

Thanks :user:`evelyn9191` for the PR.

0.19.0

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

* Drop support for Python 2.7 and 3.5 (:issue:`241`).
* Drop support for marshmallow<2.15.2.
* Only support sqlalchemy>=1.2.0.

Page 4 of 10

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.