geonature.core.taxonomie.schemas

Classes

TaxrefSchema

SQLAlchemyAutoSchema that automatically generates marshmallow fields

Module Contents

class geonature.core.taxonomie.schemas.TaxrefSchema(*args, **kwargs)[source]

Bases: geonature.utils.env.MA.SQLAlchemyAutoSchema

SQLAlchemyAutoSchema that automatically generates marshmallow fields from a SQLAlchemy model’s or table’s column. Uses the scoped session from Flask-SQLAlchemy by default.

See marshmallow_sqlalchemy.SQLAlchemyAutoSchema for more details on the SQLAlchemyAutoSchema API.

class Meta[source]

Options object for a Schema.

Example usage:

from marshmallow import Schema


class MySchema(Schema):
    class Meta:
        fields = ("id", "email", "date_created")
        exclude = ("password", "secret_attribute")

A note on type checking

Type checkers will only check the attributes of the Meta <marshmallow.Schema.Meta> class if you explicitly subclass marshmallow.Schema.Meta.

from marshmallow import Schema


class MySchema(Schema):
    # Not checked by type checkers
    class Meta:
        additional = True


class MySchema2(Schema):
    # Type checkers will check attributes
    class Meta(Schema.Meta):
        additional = True  # Incompatible types in assignment

Supprimé dans la version 3.0.0b7: Remove strict.

Ajouté dans la version 3.0.0b12: Add unknown.

Modifié dans la version 3.0.0b17: Rename dateformat to datetimeformat.

Ajouté dans la version 3.9.0: Add timeformat.

Modifié dans la version 3.26.0: Deprecate ordered. Field order is preserved by default.

Supprimé dans la version 4.0.0: Remove ordered.

model[source]
load_instance = True[source]
include_fk = True[source]