geonature.core.gn_meta.models

Submodules

Attributes

Classes

TDatasets

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

TAcquisitionFramework

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

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.

TDatasets

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

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.

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.

Functions

get_scopes_by_action([id_role, module_code, object_code])

This function gets the scopes permissions for each one of the 6 actions in "CRUVED",

get_scopes_by_action([id_role, module_code, object_code])

This function gets the scopes permissions for each one of the 6 actions in "CRUVED",

Package Contents

geonature.core.gn_meta.models.get_scopes_by_action(id_role=None, module_code=None, object_code=None)[source]

This function gets the scopes permissions for each one of the 6 actions in « CRUVED », that match (id_role, module_code, object_code)

:returns : (dict) A dict of the scope for each one of the 6 actions (the char in « CRUVED »)

class geonature.core.gn_meta.models.TDatasets[source]

Bases: geonature.core.gn_meta.models.commons.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_datasets'
__table_args__
id_dataset
unique_dataset_id
id_acquisition_framework
acquisition_framework
dataset_name
dataset_shortname
dataset_desc
id_nomenclature_data_type
keywords
marine_domain
terrestrial_domain
id_nomenclature_dataset_objectif
bbox_west
bbox_east
bbox_south
bbox_north
id_nomenclature_collecting_method
id_nomenclature_data_origin
id_nomenclature_source_status
id_nomenclature_resource_type
meta_create_date
meta_update_date
active
validable
id_digitizer
digitizer
creator
id_taxa_list
modules
additional_data
nomenclature_data_type
nomenclature_dataset_objectif
nomenclature_collecting_method
nomenclature_data_origin
nomenclature_source_status
nomenclature_resource_type
cor_territories
cor_dataset_actor
additional_fields
user_actors()[source]
organism_actors()[source]
is_deletable()[source]
has_instance_permission(scope, _through_af=True)[source]

_through_af prevent infinite recursion

__str__()[source]
static get_id(uuid_dataset)[source]
static get_uuid(id_dataset)[source]
classmethod _get_read_scope(user=None)[source]
classmethod _get_create_scope(module_code, user=None, object_code=None)[source]
classmethod filter_by_scope(scope, *, query, user=None)[source]
classmethod filter_by_params(params={}, *, _af_search=True, query=None)[source]
classmethod filter_by_readable(query, user=None)[source]

Return the datasets where the user has autorization via its CRUVED

classmethod filter_by_creatable(module_code, *, query, user=None, object_code=None)[source]

Return all dataset where user have read rights minus those who user to not have create rigth

classmethod filter_by_areas(areas, *, query)[source]
nb_observations()[source]
class geonature.core.gn_meta.models.TAcquisitionFramework[source]

Bases: geonature.core.gn_meta.models.commons.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_acquisition_frameworks'
__table_args__
id_acquisition_framework
unique_acquisition_framework_id
acquisition_framework_name
acquisition_framework_desc
id_nomenclature_territorial_level
territory_desc
keywords
id_nomenclature_financing_type
target_description
ecologic_or_geologic_target
acquisition_framework_parent_id
is_parent
opened
id_digitizer
acquisition_framework_start_date
acquisition_framework_end_date
additional_data
meta_create_date
meta_update_date
initial_closing_date
creator
nomenclature_territorial_level
nomenclature_financing_type
cor_af_actor
cor_objectifs
cor_volets_sinp
cor_territories
bibliographical_references
t_datasets
datasets
user_actors()[source]
organism_actors()[source]
has_datasets()[source]
has_child_acquisition_framework()[source]
has_instance_permission(scope, _through_ds=True)[source]
static get_id(uuid_af)[source]

return the acquisition framework’s id from its UUID if exist or None

static get_user_af(user, only_query=False, only_user=False)[source]

get the af(s) where the user is actor (himself or with its organism - only himelsemf id only_use=True) or digitizer param:

  • user from TRole model

  • only_query: boolean (return the query not the id_datasets allowed if true)

  • only_user: boolean: return only the dataset where user himself is actor (not with its organoism)

return: a list of id_dataset or a query

classmethod _get_read_scope(user=None)[source]
classmethod filter_by_scope(scope, *, query, user=None)[source]
classmethod filter_by_readable(*, query, user=None)[source]

Return the afs where the user has autorization via its CRUVED

classmethod filter_by_areas(areas, *, query)[source]

Filter meta by areas

classmethod filter_by_params(params={}, *, _ds_search=True, query=None)[source]
geonature.core.gn_meta.models.MIN_LENGTH_UUID_OR_DATE_SEARCH_STRING = 5[source]
class geonature.core.gn_meta.models.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
month
day
class geonature.core.gn_meta.models.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

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'
uuid
name
date
person
organism
areas
search
is_parent
opened
convert_date(data, **kwargs)[source]
geonature.core.gn_meta.models.cor_acquisition_framework_objectif[source]
geonature.core.gn_meta.models.cor_acquisition_framework_voletsinp[source]
geonature.core.gn_meta.models.cor_acquisition_framework_territory[source]
class geonature.core.gn_meta.models.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'
__table_args__
id_cafa
id_acquisition_framework
id_role
id_organism
id_nomenclature_actor_role
nomenclature_actor_role
role
organism
class geonature.core.gn_meta.models.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'
__table_args__
id_cda
id_dataset
id_role
id_organism
id_nomenclature_actor_role
nomenclature_actor_role
role
organism
actor()[source]
display()[source]
class geonature.core.gn_meta.models.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'
__table_args__
id_cdp
id_dataset
id_protocol
geonature.core.gn_meta.models.cor_dataset_territory[source]
class geonature.core.gn_meta.models.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'
__table_args__
id_bibliographic_reference
id_acquisition_framework
publication_url
publication_reference
geonature.core.gn_meta.models.get_scopes_by_action(id_role=None, module_code=None, object_code=None)[source]

This function gets the scopes permissions for each one of the 6 actions in « CRUVED », that match (id_role, module_code, object_code)

:returns : (dict) A dict of the scope for each one of the 6 actions (the char in « CRUVED »)

class geonature.core.gn_meta.models.TDatasets[source]

Bases: geonature.core.gn_meta.models.commons.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_datasets'
__table_args__
id_dataset
unique_dataset_id
id_acquisition_framework
acquisition_framework
dataset_name
dataset_shortname
dataset_desc
id_nomenclature_data_type
keywords
marine_domain
terrestrial_domain
id_nomenclature_dataset_objectif
bbox_west
bbox_east
bbox_south
bbox_north
id_nomenclature_collecting_method
id_nomenclature_data_origin
id_nomenclature_source_status
id_nomenclature_resource_type
meta_create_date
meta_update_date
active
validable
id_digitizer
digitizer
creator
id_taxa_list
modules
additional_data
nomenclature_data_type
nomenclature_dataset_objectif
nomenclature_collecting_method
nomenclature_data_origin
nomenclature_source_status
nomenclature_resource_type
cor_territories
cor_dataset_actor
additional_fields
user_actors()[source]
organism_actors()[source]
is_deletable()[source]
has_instance_permission(scope, _through_af=True)[source]

_through_af prevent infinite recursion

__str__()[source]
static get_id(uuid_dataset)[source]
static get_uuid(id_dataset)[source]
classmethod _get_read_scope(user=None)[source]
classmethod _get_create_scope(module_code, user=None, object_code=None)[source]
classmethod filter_by_scope(scope, *, query, user=None)[source]
classmethod filter_by_params(params={}, *, _af_search=True, query=None)[source]
classmethod filter_by_readable(query, user=None)[source]

Return the datasets where the user has autorization via its CRUVED

classmethod filter_by_creatable(module_code, *, query, user=None, object_code=None)[source]

Return all dataset where user have read rights minus those who user to not have create rigth

classmethod filter_by_areas(areas, *, query)[source]
nb_observations()[source]
geonature.core.gn_meta.models.MIN_LENGTH_UUID_OR_DATE_SEARCH_STRING = 5[source]
class geonature.core.gn_meta.models.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
month
day
class geonature.core.gn_meta.models.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

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'
uuid
name
date
person
organism
areas
search
is_parent
opened
convert_date(data, **kwargs)[source]
geonature.core.gn_meta.models.cor_acquisition_framework_objectif[source]
geonature.core.gn_meta.models.cor_acquisition_framework_voletsinp[source]
geonature.core.gn_meta.models.cor_acquisition_framework_territory[source]
class geonature.core.gn_meta.models.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'
__table_args__
id_cafa
id_acquisition_framework
id_role
id_organism
id_nomenclature_actor_role
nomenclature_actor_role
role
organism
class geonature.core.gn_meta.models.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'
__table_args__
id_cda
id_dataset
id_role
id_organism
id_nomenclature_actor_role
nomenclature_actor_role
role
organism
actor()[source]
display()[source]
class geonature.core.gn_meta.models.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'
__table_args__
id_cdp
id_dataset
id_protocol
geonature.core.gn_meta.models.cor_dataset_territory[source]
class geonature.core.gn_meta.models.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'
__table_args__
id_bibliographic_reference
id_acquisition_framework
publication_url
publication_reference
geonature.core.gn_meta.models.MIN_LENGTH_UUID_OR_DATE_SEARCH_STRING = 5[source]
class geonature.core.gn_meta.models.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
month
day
class geonature.core.gn_meta.models.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

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'
uuid
name
date
person
organism
areas
search
is_parent
opened
convert_date(data, **kwargs)[source]
geonature.core.gn_meta.models.cor_acquisition_framework_objectif[source]
geonature.core.gn_meta.models.cor_acquisition_framework_voletsinp[source]
geonature.core.gn_meta.models.cor_acquisition_framework_territory[source]
class geonature.core.gn_meta.models.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'
__table_args__
id_cafa
id_acquisition_framework
id_role
id_organism
id_nomenclature_actor_role
nomenclature_actor_role
role
organism
class geonature.core.gn_meta.models.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'
__table_args__
id_cda
id_dataset
id_role
id_organism
id_nomenclature_actor_role
nomenclature_actor_role
role
organism
actor()[source]
display()[source]
class geonature.core.gn_meta.models.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'
__table_args__
id_cdp
id_dataset
id_protocol
geonature.core.gn_meta.models.cor_dataset_territory[source]
class geonature.core.gn_meta.models.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'
__table_args__
id_bibliographic_reference
id_acquisition_framework
publication_url
publication_reference