geonature.core.gn_meta.models.commons

Attributes

Classes

DateFilterSchema

Base schema class with which to define schemas.

MetadataFilterSchema

Base schema class with which to define schemas.

CorAcquisitionFrameworkActor

The base class of the SQLAlchemy.Model declarative model class.

CorDatasetActor

The base class of the SQLAlchemy.Model declarative model class.

CorDatasetProtocol

The base class of the SQLAlchemy.Model declarative model class.

TBibliographicReference

The base class of the SQLAlchemy.Model declarative model class.

Module Contents

geonature.core.gn_meta.models.commons.MIN_LENGTH_UUID_OR_DATE_SEARCH_STRING = 5[source]
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.Schema

Base 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 obj is 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 Nested fields 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 prefix parameter.

Modifié dans la version 4.0.0: Remove context parameter.

year[source]
month[source]
day[source]
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.Schema

Base 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 obj is 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 Nested fields 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 prefix parameter.

Modifié dans la version 4.0.0: Remove context parameter.

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.

unknown = 'exclude'[source]
uuid[source]
name[source]
date[source]
person[source]
organism[source]
areas[source]
search[source]
is_parent[source]
opened[source]
convert_date(data, **kwargs)[source]
geonature.core.gn_meta.models.commons.cor_acquisition_framework_objectif[source]
geonature.core.gn_meta.models.commons.cor_acquisition_framework_voletsinp[source]
geonature.core.gn_meta.models.commons.cor_acquisition_framework_territory[source]
class geonature.core.gn_meta.models.commons.CorAcquisitionFrameworkActor[source]

Bases: geonature.utils.env.DB.Model

The base class of the SQLAlchemy.Model declarative model class.

To define models, subclass db.Model, not this. To customize db.Model, subclass this and pass it as model_class to SQLAlchemy. To customize db.Model at the metaclass level, pass an already created declarative model class as model_class.

__tablename__ = 'cor_acquisition_framework_actor'[source]
__table_args__[source]
id_cafa[source]
id_acquisition_framework[source]
id_role[source]
id_organism[source]
id_nomenclature_actor_role[source]
nomenclature_actor_role[source]
role[source]
organism[source]
class geonature.core.gn_meta.models.commons.CorDatasetActor[source]

Bases: geonature.utils.env.DB.Model

The base class of the SQLAlchemy.Model declarative model class.

To define models, subclass db.Model, not this. To customize db.Model, subclass this and pass it as model_class to SQLAlchemy. To customize db.Model at the metaclass level, pass an already created declarative model class as model_class.

__tablename__ = 'cor_dataset_actor'[source]
__table_args__[source]
id_cda[source]
id_dataset[source]
id_role[source]
id_organism[source]
id_nomenclature_actor_role[source]
nomenclature_actor_role[source]
role[source]
organism[source]
actor()[source]
display()[source]
class geonature.core.gn_meta.models.commons.CorDatasetProtocol[source]

Bases: geonature.utils.env.DB.Model

The base class of the SQLAlchemy.Model declarative model class.

To define models, subclass db.Model, not this. To customize db.Model, subclass this and pass it as model_class to SQLAlchemy. To customize db.Model at the metaclass level, pass an already created declarative model class as model_class.

__tablename__ = 'cor_dataset_protocol'[source]
__table_args__[source]
id_cdp[source]
id_dataset[source]
id_protocol[source]
geonature.core.gn_meta.models.commons.cor_dataset_territory[source]
class geonature.core.gn_meta.models.commons.TBibliographicReference[source]

Bases: geonature.utils.env.db.Model

The base class of the SQLAlchemy.Model declarative model class.

To define models, subclass db.Model, not this. To customize db.Model, subclass this and pass it as model_class to SQLAlchemy. To customize db.Model at the metaclass level, pass an already created declarative model class as model_class.

__tablename__ = 't_bibliographical_references'[source]
__table_args__[source]
id_bibliographic_reference[source]
id_acquisition_framework[source]
publication_url[source]
publication_reference[source]