Using the Session Session Basics Basics of Using a Session Framing out a begin / commit / rollback blockQueryingDeletingGet by Primary KeyUPDATE and DELETE with arbitrary WHERE clauseCommittingClosing When do I make a sessionmaker?Is the Session a cache?Is the session thread-safe? Quickie Intro to Object States Session AttributesMerging Expunging What Actually Loads Cascades Behavior of save-update cascade with bi-directional relationships Using delete cascade with many-to-many relationshipsUsing foreign key ON DELETE with many-to-many relationships mergeNotes on Delete - Deleting Objects Referenced from Collections and Scalar Relationships Managing Transactions Session-level vs. Engine level transaction controlEnabling Two-Phase CommitTracking Transaction State with Events Additional Persistence Techniques Using SQL Expressions with SessionsFetching Server-Generated Defaults Case 2: Table includes trigger-generated values which are not compatible with RETURNINGCase 4: primary key, RETURNING or equivalent is supportedNotes on eagerly fetching client invoked SQL expressions used for INSERT or UPDATE Using PostgreSQL ON CONFLICT with RETURNING to return upserted ORM objects Simple Vertical PartitioningCustom Vertical Partitioning Bulk Operations Implicit Method AccessUsing Thread-Local Scope with Web ApplicationsContextual Session API ScopedRegistry Tracking queries, object and Session Changes with Events Basic Query Interception Persistence Events after_flush()Mapper-level Events TransientPending to PersistentLoaded as PersistentPersistent to DeletedPersistent to DetachedDeleted to Persistent Attribute Change Events Session and sessionmaker() ORMExecuteStateSessionTransaction Session Utilities make_transient()object_session() Attribute and State Management Utilities del_attribute()get_history()flag_modified()instance_state()set_attribute()