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 ? Programmation Python
Les fondamentaux
Voir le programme détaillé
Module « sqlalchemy.orm »

Classe « scoped_session »

Informations générales

Héritage

builtins.object
    Generic
        scoped_session

Définition

class scoped_session(Generic):

help(scoped_session)

Provides scoped management of :class:`.Session` objects.

See :ref:`unitofwork_contextual` for a tutorial.

.. note::

   When using :ref:`asyncio_toplevel`, the async-compatible
   :class:`_asyncio.async_scoped_session` class should be
   used in place of :class:`.scoped_session`.

Constructeur(s)

Signature du constructeur Description
__init__(self, session_factory: 'sessionmaker[_S]', scopefunc: 'Optional[Callable[[], Any]]' = None) Construct a new :class:`.scoped_session`. [extrait de __init__.__doc__]

Liste des propriétés

Nom de la propriétéDescription
autoflushProxy for the :attr:`_orm.Session.autoflush` attribute [extrait de autoflush.__doc__]
bindProxy for the :attr:`_orm.Session.bind` attribute [extrait de bind.__doc__]
deletedThe set of all instances marked as 'deleted' within this ``Session`` [extrait de deleted.__doc__]
dirtyThe set of all persistent instances considered dirty. [extrait de dirty.__doc__]
identity_mapProxy for the :attr:`_orm.Session.identity_map` attribute [extrait de identity_map.__doc__]
infoA user-modifiable dictionary. [extrait de info.__doc__]
is_activeTrue if this :class:`.Session` not in "partial rollback" state. [extrait de is_active.__doc__]
newThe set of all instances marked as 'new' within this ``Session``. [extrait de new.__doc__]
no_autoflushReturn a context manager that disables autoflush. [extrait de no_autoflush.__doc__]

Liste des opérateurs

Signature de l'opérateur Description
__contains__(self, instance: 'object') -> 'bool' Return True if the instance is associated with this session. [extrait de __contains__.__doc__]

Opérateurs hérités de la classe object

__eq__, __ge__, __gt__, __le__, __lt__, __ne__

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__call__(self, **kw: 'Any') -> '_S' Return the current :class:`.Session`, creating it [extrait de __call__.__doc__]
__class_getitem__ Parameterizes a generic class. [extrait de __class_getitem__.__doc__]
__iter__(self) -> 'Iterator[object]' Iterate over all pending or persistent instances within this [extrait de __iter__.__doc__]
add(self, instance: 'object', _warn: 'bool' = True) -> 'None' Place an object into this :class:`_orm.Session`. [extrait de add.__doc__]
add_all(self, instances: 'Iterable[object]') -> 'None' Add the given collection of instances to this :class:`_orm.Session`. [extrait de add_all.__doc__]
begin(self, nested: 'bool' = False) -> 'SessionTransaction' Begin a transaction, or nested transaction, [extrait de begin.__doc__]
begin_nested(self) -> 'SessionTransaction' Begin a "nested" transaction on this Session, e.g. SAVEPOINT. [extrait de begin_nested.__doc__]
bulk_insert_mappings(self, mapper: 'Mapper[Any]', mappings: 'Iterable[Dict[str, Any]]', return_defaults: 'bool' = False, render_nulls: 'bool' = False) -> 'None' Perform a bulk insert of the given list of mapping dictionaries. [extrait de bulk_insert_mappings.__doc__]
bulk_save_objects(self, objects: 'Iterable[object]', return_defaults: 'bool' = False, update_changed_only: 'bool' = True, preserve_order: 'bool' = True) -> 'None' Perform a bulk save of the given list of objects. [extrait de bulk_save_objects.__doc__]
bulk_update_mappings(self, mapper: 'Mapper[Any]', mappings: 'Iterable[Dict[str, Any]]') -> 'None' Perform a bulk update of the given list of mapping dictionaries. [extrait de bulk_update_mappings.__doc__]
close(self) -> 'None' Close out the transactional resources and ORM objects used by this [extrait de close.__doc__]
close_all() -> 'None' Close *all* sessions in memory. [extrait de close_all.__doc__]
commit(self) -> 'None' Flush pending changes and commit the current transaction. [extrait de commit.__doc__]
configure(self, **kwargs: 'Any') -> 'None' reconfigure the :class:`.sessionmaker` used by this [extrait de configure.__doc__]
connection(self, bind_arguments: 'Optional[_BindArguments]' = None, execution_options: 'Optional[CoreExecuteOptionsParameter]' = None) -> 'Connection' Return a :class:`_engine.Connection` object corresponding to this [extrait de connection.__doc__]
delete(self, instance: 'object') -> 'None' Mark an instance as deleted. [extrait de delete.__doc__]
execute(self, statement: 'Executable', params: 'Optional[_CoreAnyExecuteParams]' = None, *, execution_options: 'OrmExecuteOptionsParameter' = immutabledict({}), bind_arguments: 'Optional[_BindArguments]' = None, _parent_execute_state: 'Optional[Any]' = None, _add_event: 'Optional[Any]' = None) -> 'Result[Any]' Execute a SQL expression construct. [extrait de execute.__doc__]
expire(self, instance: 'object', attribute_names: 'Optional[Iterable[str]]' = None) -> 'None' Expire the attributes on an instance. [extrait de expire.__doc__]
expire_all(self) -> 'None' Expires all persistent instances within this Session. [extrait de expire_all.__doc__]
expunge(self, instance: 'object') -> 'None' Remove the `instance` from this ``Session``. [extrait de expunge.__doc__]
expunge_all(self) -> 'None' Remove all object instances from this ``Session``. [extrait de expunge_all.__doc__]
flush(self, objects: 'Optional[Sequence[Any]]' = None) -> 'None' Flush all the object changes to the database. [extrait de flush.__doc__]
get(self, entity: '_EntityBindKey[_O]', ident: '_PKIdentityArgument', *, options: 'Optional[Sequence[ORMOption]]' = None, populate_existing: 'bool' = False, with_for_update: 'ForUpdateParameter' = None, identity_token: 'Optional[Any]' = None, execution_options: 'OrmExecuteOptionsParameter' = immutabledict({}), bind_arguments: 'Optional[_BindArguments]' = None) -> 'Optional[_O]' Return an instance based on the given primary key identifier, [extrait de get.__doc__]
get_bind(self, mapper: 'Optional[_EntityBindKey[_O]]' = None, *, clause: 'Optional[ClauseElement]' = None, bind: 'Optional[_SessionBind]' = None, _sa_skip_events: 'Optional[bool]' = None, _sa_skip_for_implicit_returning: 'bool' = False, **kw: 'Any') -> 'Union[Engine, Connection]' Return a "bind" to which this :class:`.Session` is bound. [extrait de get_bind.__doc__]
get_one(self, entity: '_EntityBindKey[_O]', ident: '_PKIdentityArgument', *, options: 'Optional[Sequence[ORMOption]]' = None, populate_existing: 'bool' = False, with_for_update: 'ForUpdateParameter' = None, identity_token: 'Optional[Any]' = None, execution_options: 'OrmExecuteOptionsParameter' = immutabledict({}), bind_arguments: 'Optional[_BindArguments]' = None) -> '_O' Return exactly one instance based on the given primary key [extrait de get_one.__doc__]
identity_key(class_: 'Optional[Type[Any]]' = None, ident: 'Union[Any, Tuple[Any, ...]]' = None, *, instance: 'Optional[Any]' = None, row: 'Optional[Union[Row[Any], RowMapping]]' = None, identity_token: 'Optional[Any]' = None) -> '_IdentityKeyType[Any]' Return an identity key. [extrait de identity_key.__doc__]
is_modified(self, instance: 'object', include_collections: 'bool' = True) -> 'bool' Return ``True`` if the given instance has locally [extrait de is_modified.__doc__]
merge(self, instance: '_O', *, load: 'bool' = True, options: 'Optional[Sequence[ORMOption]]' = None) -> '_O' Copy the state of a given instance into a corresponding instance [extrait de merge.__doc__]
object_session(instance: 'object') -> 'Optional[Session]' Return the :class:`.Session` to which an object belongs. [extrait de object_session.__doc__]
query(self, *entities: '_ColumnsClauseArgument[Any]', **kwargs: 'Any') -> 'Query[Any]' Return a new :class:`_query.Query` object corresponding to this [extrait de query.__doc__]
query_property(self, query_cls: 'Optional[Type[Query[_T]]]' = None) -> 'QueryPropertyDescriptor' return a class property which produces a legacy [extrait de query_property.__doc__]
refresh(self, instance: 'object', attribute_names: 'Optional[Iterable[str]]' = None, with_for_update: 'ForUpdateParameter' = None) -> 'None' Expire and refresh attributes on the given instance. [extrait de refresh.__doc__]
remove(self) -> 'None' Dispose of the current :class:`.Session`, if present. [extrait de remove.__doc__]
reset(self) -> 'None' Close out the transactional resources and ORM objects used by this [extrait de reset.__doc__]
rollback(self) -> 'None' Rollback the current transaction in progress. [extrait de rollback.__doc__]
scalar(self, statement: 'Executable', params: 'Optional[_CoreSingleExecuteParams]' = None, *, execution_options: 'OrmExecuteOptionsParameter' = immutabledict({}), bind_arguments: 'Optional[_BindArguments]' = None, **kw: 'Any') -> 'Any' Execute a statement and return a scalar result. [extrait de scalar.__doc__]
scalars(self, statement: 'Executable', params: 'Optional[_CoreAnyExecuteParams]' = None, *, execution_options: 'OrmExecuteOptionsParameter' = immutabledict({}), bind_arguments: 'Optional[_BindArguments]' = None, **kw: 'Any') -> 'ScalarResult[Any]' Execute a statement and return the results as scalars. [extrait de scalars.__doc__]

Méthodes héritées de la classe Generic

__init_subclass__, __subclasshook__

Méthodes héritées de la classe object

__delattr__, __dir__, __format__, __getattribute__, __getstate__, __hash__, __init_subclass__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Vous êtes un professionnel et vous avez besoin d'une formation ? Calcul scientifique
avec Python
Voir le programme détaillé