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 :

Module « sqlalchemy.orm »

Classe « Session »

Informations générales

Héritage

builtins.object
    _SessionClassMethods
        Session

Définition

class Session(_SessionClassMethods):

Description [extrait de Session.__doc__]

Manages persistence operations for ORM-mapped objects.

    The Session's usage paradigm is described at :doc:`/orm/session`.


    

Constructeur(s)

Signature du constructeur Description
__init__(self, bind=None, autoflush=True, future=False, expire_on_commit=True, autocommit=False, twophase=False, binds=None, enable_baked_queries=True, info=None, query_cls=None) Construct a new Session. [extrait de __init__.__doc__]

Liste des attributs statiques

Nom de l'attribut Valeur
connection_callableNone
dispatch<sqlalchemy.event.base.SessionEventsDispatch object at 0x7f40cb8a0150>
identity_mapNone
info<sqlalchemy.util.langhelpers.memoized_property object at 0x7f40cb857460>

Liste des propriétés

Nom de la propriétéDescription
deletedThe set of all instances marked as 'deleted' within this ``Session`` [extrait de __doc__]
dirtyThe set of all persistent instances considered dirty. [extrait de __doc__]
is_activeTrue if this :class:`.Session` not in "partial rollback" state. [extrait de __doc__]
newThe set of all instances marked as 'new' within this ``Session``. [extrait de __doc__]
no_autoflushReturn a context manager that disables autoflush. [extrait de __doc__]
transactionThe current active or inactive :class:`.SessionTransaction`. [extrait de __doc__]

Liste des opérateurs

Signature de l'opérateur Description
__contains__(self, instance) 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
__enter__(self)
__exit__(self, type_, value, traceback)
__iter__(self) Iterate over all pending or persistent instances within this [extrait de __iter__.__doc__]
add(self, instance, _warn=True) Place an object in the ``Session``. [extrait de add.__doc__]
add_all(self, instances) Add the given collection of instances to this ``Session``. [extrait de add_all.__doc__]
begin(self, subtransactions=False, nested=False, _subtrans=False) Begin a transaction, or nested transaction, [extrait de begin.__doc__]
begin_nested(self) Begin a "nested" transaction on this Session, e.g. SAVEPOINT. [extrait de begin_nested.__doc__]
bind_mapper(self, mapper, bind) Associate a :class:`_orm.Mapper` or arbitrary Python class with a [extrait de bind_mapper.__doc__]
bind_table(self, table, bind) Associate a :class:`_schema.Table` with a "bind", e.g. an [extrait de bind_table.__doc__]
bulk_insert_mappings(self, mapper, mappings, return_defaults=False, render_nulls=False) Perform a bulk insert of the given list of mapping dictionaries. [extrait de bulk_insert_mappings.__doc__]
bulk_save_objects(self, objects, return_defaults=False, update_changed_only=True, preserve_order=True) Perform a bulk save of the given list of objects. [extrait de bulk_save_objects.__doc__]
bulk_update_mappings(self, mapper, mappings) Perform a bulk update of the given list of mapping dictionaries. [extrait de bulk_update_mappings.__doc__]
close(self) Close out the transactional resources and ORM objects used by this [extrait de close.__doc__]
commit(self) Flush pending changes and commit the current transaction. [extrait de commit.__doc__]
connection(self, bind_arguments=None, close_with_result=False, execution_options=None, **kw) Return a :class:`_engine.Connection` object corresponding to this [extrait de connection.__doc__]
delete(self, instance) Mark an instance as deleted. [extrait de delete.__doc__]
enable_relationship_loading(self, obj) Associate an object with this :class:`.Session` for related [extrait de enable_relationship_loading.__doc__]
execute(self, statement, params=None, execution_options=immutabledict({}), bind_arguments=None, _parent_execute_state=None, _add_event=None, **kw) Execute a SQL expression construct. [extrait de execute.__doc__]
expire(self, instance, attribute_names=None) Expire the attributes on an instance. [extrait de expire.__doc__]
expire_all(self) Expires all persistent instances within this Session. [extrait de expire_all.__doc__]
expunge(self, instance) Remove the `instance` from this ``Session``. [extrait de expunge.__doc__]
expunge_all(self) Remove all object instances from this ``Session``. [extrait de expunge_all.__doc__]
flush(self, objects=None) Flush all the object changes to the database. [extrait de flush.__doc__]
get(self, entity, ident, options=None, populate_existing=False, with_for_update=None, identity_token=None) Return an instance based on the given primary key identifier, [extrait de get.__doc__]
get_bind(self, mapper=None, clause=None, bind=None, _sa_skip_events=None, _sa_skip_for_implicit_returning=False) Return a "bind" to which this :class:`.Session` is bound. [extrait de get_bind.__doc__]
get_nested_transaction(self) Return the current nested transaction in progress, if any. [extrait de get_nested_transaction.__doc__]
get_transaction(self) Return the current root transaction in progress, if any. [extrait de get_transaction.__doc__]
in_nested_transaction(self) Return True if this :class:`_orm.Session` has begun a nested [extrait de in_nested_transaction.__doc__]
in_transaction(self) Return True if this :class:`_orm.Session` has begun a transaction. [extrait de in_transaction.__doc__]
invalidate(self) Close this Session, using connection invalidation. [extrait de invalidate.__doc__]
is_modified(self, instance, include_collections=True) Return ``True`` if the given instance has locally [extrait de is_modified.__doc__]
merge(self, instance, load=True, options=None) Copy the state of a given instance into a corresponding instance [extrait de merge.__doc__]
prepare(self) Prepare the current transaction in progress for two phase commit. [extrait de prepare.__doc__]
query(self, *entities, **kwargs) Return a new :class:`_query.Query` object corresponding to this [extrait de query.__doc__]
refresh(self, instance, attribute_names=None, with_for_update=None) Expire and refresh attributes on the given instance. [extrait de refresh.__doc__]
rollback(self) Rollback the current transaction in progress. [extrait de rollback.__doc__]
scalar(self, statement, params=None, execution_options=immutabledict({}), bind_arguments=None, **kw) Execute a statement and return a scalar result. [extrait de scalar.__doc__]
scalars(self, statement, params=None, execution_options=immutabledict({}), bind_arguments=None, **kw) Execute a statement and return the results as scalars. [extrait de scalars.__doc__]

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

__init_subclass__, __subclasshook__, close_all, identity_key, object_session

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

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