SQLAlchemy
The Database Toolkit for Python
The Database Toolkit for Python
  • home
  • features
    • Feature Overview
    • Testimonials
  • news
  • documentation
    • Current Documentation (version 2.0)

    • Documentation by Version
    • Version 2.0
    • Version 1.4
    • Version 1.3

    • Talks and Tutorials
    • Published content overview
  • community
    • Get Support
    • Participate
    • Develop
    • Code of Conduct
    • Github
  • download
    • Download
    • Current Release Series (2.0)
    • Maintenance Release (1.4)
    • Development Access
    • License
    • Version Numbering
    • Release Status
Release: 1.3.24 legacy version | Release Date: March 30, 2021

SQLAlchemy 1.3 Documentation

SQLAlchemy 1.3 Documentation

legacy version

Home | Download this Documentation

SQLAlchemy ORM

  • Object Relational Tutorial
  • Mapper Configuration
  • Relationship Configuration
  • Loading Objects
  • Using the Session¶
    • Session Basics
    • State Management
    • Cascades
    • Transactions and Connection Management
    • Additional Persistence Techniques
    • Contextual/Thread-local Sessions
    • Tracking Object and Session Changes with Events
    • Session API
  • Events and Internals
  • ORM Extensions
  • ORM Examples

Project Versions

  • 1.3.24

Home | Download this Documentation

  • Previous: Query API
  • Next: Session Basics
  • Up: Home
    • SQLAlchemy ORM
  • On this page:
    • Using the Session

Using the Session¶

The mapper() function and declarative extensions are the primary configurational interface for the ORM. Once mappings are configured, the primary usage interface for persistence operations is the Session.

  • Session Basics
    • What does the Session do ?
    • Getting a Session
    • Session Frequently Asked Questions
    • Basics of Using a Session
  • State Management
    • Quickie Intro to Object States
    • Session Attributes
    • Session Referencing Behavior
    • Merging
    • Expunging
    • Refreshing / Expiring
  • Cascades
    • save-update
    • delete
    • delete-orphan
    • merge
    • refresh-expire
    • expunge
    • Controlling Cascade on Backrefs
  • Transactions and Connection Management
    • Managing Transactions
    • Joining a Session into an External Transaction (such as for test suites)
  • Additional Persistence Techniques
    • Embedding SQL Insert/Update Expressions into a Flush
    • Using SQL Expressions with Sessions
    • Forcing NULL on a column with a default
    • Fetching Server-Generated Defaults
    • Partitioning Strategies (e.g. multiple database backends per Session)
    • Bulk Operations
  • Contextual/Thread-local Sessions
    • Implicit Method Access
    • Thread-Local Scope
    • Using Thread-Local Scope with Web Applications
    • Using Custom Created Scopes
    • Contextual Session API
  • Tracking Object and Session Changes with Events
    • Persistence Events
    • Object Lifecycle Events
    • Transaction Events
    • Attribute Change Events
  • Session API
    • Session and sessionmaker()
    • Session Utilities
    • Attribute and State Management Utilities
Previous: Query API Next: Session Basics
© Copyright 2007-2021, the SQLAlchemy authors and contributors.

flambé! the dragon and The Alchemist image designs created and generously donated by Rotem Yaari.

Created using Sphinx 5.3.0. Documentation last generated: Fri 27 Jan 2023 02:38:52 PM

SQLAlchemy Sponsors

Python

Website content copyright © by SQLAlchemy authors and contributors. SQLAlchemy and its documentation are licensed under the MIT license.

SQLAlchemy is a trademark of Michael Bayer. mike(&)zzzcomputing.com All rights reserved.

Website generation by zeekofile, with huge thanks to the Blogofile project.

Mastodon