Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Mise en oeuvre d'IHM
avec Qt et PySide6
Voir le programme détaillé
Module « sqlalchemy.orm »

Fonction keyfunc_mapping - module sqlalchemy.orm

Signature de la fonction keyfunc_mapping

def keyfunc_mapping(keyfunc: 'Callable[[Any], Any]', *, ignore_unpopulated_attribute: 'bool' = False) -> 'Type[KeyFuncDict[_KT, Any]]' 

Description

help(sqlalchemy.orm.keyfunc_mapping)

A dictionary-based collection type with arbitrary keying.

.. versionchanged:: 2.0 Renamed :data:`.mapped_collection` to
   :func:`.keyfunc_mapping`.

Returns a :class:`.KeyFuncDict` factory with a keying function
generated from keyfunc, a callable that takes an entity and returns a
key value.

.. note:: the given keyfunc is called only once at the time that the
   target object is being added to the collection.   Changes to the
   effective value returned by the function are not tracked.


.. seealso::

    :ref:`orm_dictionary_collection` - background on use

:param keyfunc: a callable that will be passed the ORM-mapped instance
 which should then generate a new key to use in the dictionary.
 If the value returned is :attr:`.LoaderCallableStatus.NO_VALUE`, an error
 is raised.
:param ignore_unpopulated_attribute:  if True, and the callable returns
 :attr:`.LoaderCallableStatus.NO_VALUE` for a particular instance, the
 operation will be silently skipped.  By default, an error is raised.

 .. versionadded:: 2.0 an error is raised by default if the callable
    being used for the dictionary key returns
    :attr:`.LoaderCallableStatus.NO_VALUE`, which in an ORM attribute
    context indicates an attribute that was never populated with any value.
    The :paramref:`_orm.mapped_collection.ignore_unpopulated_attribute`
    parameter may be set which will instead indicate that this condition
    should be ignored, and the append operation silently skipped. This is
    in contrast to the behavior of the 1.x series which would erroneously
    populate the value in the dictionary with an arbitrary key value of
    ``None``.




Vous êtes un professionnel et vous avez besoin d'une formation ? Machine Learning
avec Scikit-Learn
Voir le programme détaillé