geonature.core.gn_meta.models.commons¶
Attributes¶
Classes¶
Base schema class with which to define schemas. |
|
Base schema class with which to define schemas. |
|
The base class of the |
|
The base class of the |
|
The base class of the |
|
The base class of the |
Module Contents¶
- class geonature.core.gn_meta.models.commons.DateFilterSchema(*, only: marshmallow.types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | marshmallow.types.StrSequenceOrSet | None = None, unknown: marshmallow.types.UnknownOption | None = None)[source]¶
Bases:
marshmallow.SchemaBase schema class with which to define schemas.
Example usage:
import datetime as dt from dataclasses import dataclass from marshmallow import Schema, fields @dataclass class Album: title: str release_date: dt.date class AlbumSchema(Schema): title = fields.Str() release_date = fields.Date() album = Album("Beggars Banquet", dt.date(1968, 12, 6)) schema = AlbumSchema() data = schema.dump(album) data # {'release_date': '1968-12-06', 'title': 'Beggars Banquet'}
- Paramètres:
only – Whitelist of the declared fields to select when instantiating the Schema. If None, all fields are used. Nested fields can be represented with dot delimiters.
exclude – Blacklist of the declared fields to exclude when instantiating the Schema. If a field appears in both only and exclude, it is not used. Nested fields can be represented with dot delimiters.
many – Should be set to True if
objis a collection so that the object will be serialized to a list.load_only – Fields to skip during serialization (write-only fields)
dump_only – Fields to skip during deserialization (read-only fields)
partial – Whether to ignore missing fields and not require any fields declared. Propagates down to
Nestedfields as well. If its value is an iterable, only missing fields listed in that iterable will be ignored. Use dot delimiters to specify nested fields.unknown – Whether to exclude, include, or raise an error for unknown fields in the data. Use EXCLUDE, INCLUDE or RAISE.
Modifié dans la version 3.0.0: Remove
prefixparameter.Modifié dans la version 4.0.0: Remove
contextparameter.
- class geonature.core.gn_meta.models.commons.MetadataFilterSchema(*, only: marshmallow.types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | marshmallow.types.StrSequenceOrSet | None = None, unknown: marshmallow.types.UnknownOption | None = None)[source]¶
Bases:
marshmallow.SchemaBase schema class with which to define schemas.
Example usage:
import datetime as dt from dataclasses import dataclass from marshmallow import Schema, fields @dataclass class Album: title: str release_date: dt.date class AlbumSchema(Schema): title = fields.Str() release_date = fields.Date() album = Album("Beggars Banquet", dt.date(1968, 12, 6)) schema = AlbumSchema() data = schema.dump(album) data # {'release_date': '1968-12-06', 'title': 'Beggars Banquet'}
- Paramètres:
only – Whitelist of the declared fields to select when instantiating the Schema. If None, all fields are used. Nested fields can be represented with dot delimiters.
exclude – Blacklist of the declared fields to exclude when instantiating the Schema. If a field appears in both only and exclude, it is not used. Nested fields can be represented with dot delimiters.
many – Should be set to True if
objis a collection so that the object will be serialized to a list.load_only – Fields to skip during serialization (write-only fields)
dump_only – Fields to skip during deserialization (read-only fields)
partial – Whether to ignore missing fields and not require any fields declared. Propagates down to
Nestedfields as well. If its value is an iterable, only missing fields listed in that iterable will be ignored. Use dot delimiters to specify nested fields.unknown – Whether to exclude, include, or raise an error for unknown fields in the data. Use EXCLUDE, INCLUDE or RAISE.
Modifié dans la version 3.0.0: Remove
prefixparameter.Modifié dans la version 4.0.0: Remove
contextparameter.- 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
dateformatto 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.
- class geonature.core.gn_meta.models.commons.CorAcquisitionFrameworkActor[source]¶
Bases:
geonature.utils.env.DB.ModelThe base class of the
SQLAlchemy.Modeldeclarative model class.To define models, subclass
db.Model, not this. To customizedb.Model, subclass this and pass it asmodel_classtoSQLAlchemy. To customizedb.Modelat the metaclass level, pass an already created declarative model class asmodel_class.
- class geonature.core.gn_meta.models.commons.CorDatasetActor[source]¶
Bases:
geonature.utils.env.DB.ModelThe base class of the
SQLAlchemy.Modeldeclarative model class.To define models, subclass
db.Model, not this. To customizedb.Model, subclass this and pass it asmodel_classtoSQLAlchemy. To customizedb.Modelat the metaclass level, pass an already created declarative model class asmodel_class.
- class geonature.core.gn_meta.models.commons.CorDatasetProtocol[source]¶
Bases:
geonature.utils.env.DB.ModelThe base class of the
SQLAlchemy.Modeldeclarative model class.To define models, subclass
db.Model, not this. To customizedb.Model, subclass this and pass it asmodel_classtoSQLAlchemy. To customizedb.Modelat the metaclass level, pass an already created declarative model class asmodel_class.
- class geonature.core.gn_meta.models.commons.TBibliographicReference[source]¶
Bases:
geonature.utils.env.db.ModelThe base class of the
SQLAlchemy.Modeldeclarative model class.To define models, subclass
db.Model, not this. To customizedb.Model, subclass this and pass it asmodel_classtoSQLAlchemy. To customizedb.Modelat the metaclass level, pass an already created declarative model class asmodel_class.