Skip to content

Essential SQLAlchemy

Resources

Modules

Book Chapters Checklist

  • 1. Schema and Types
    • Types
    • Metadata
    • Tables
    • Columns
    • Keys and Constraints
    • Indexes
    • Relationships and ForeignKeyConstraints
    • Persisting the Tables
  • 2. Working with Data via SQLAlchemy Core
    • Inserting Data
    • Querying Data
    • ResultProxy
    • Controlling the Columns in the Query
    • Ordering
    • Limiting
    • Built-In SQL Functions and Labels
    • Filtering
    • ClauseElements
    • Operators
    • Boolean Operators
    • Conjunctions
    • Updating Data
    • Deleting Data
    • Joins
    • Aliases
    • Grouping
    • Chaining
    • Raw Queries
  • 3. Exceptions and Transactions
    • Exceptions
    • AttributeError
    • IntegrityError
    • Handling Errors
    • Transactions
  • 4. Testing
    • Testing with a Test Database
    • Using Mocks
  • 5. Reflection
    • Reflecting Individual Tables
    • Reflecting a Whole Database
    • Query Building with Reflected Objects
    • II. SQLAlchemy ORM
  • 6. Defining Schema with SQLAlchemy ORM
    • Defining Tables via ORM Classes
    • Keys, Constraints, and Indexes
    • Relationships
    • Persisting the Schema
  • 7. Working with Data via SQLAlchemy ORM
    • The Session
    • Inserting Data
    • Querying Data
    • Controlling the Columns in the Query
    • Ordering
    • Limiting
    • Built-In SQL Functions and Labels
    • Filtering
    • Operators
    • Boolean Operators
    • Conjunctions
    • Updating Data
    • Deleting Data
    • Joins
    • Grouping
    • Chaining
    • Raw Queries
  • 8. Understanding the Session and Exceptions
    • The SQLAlchemy Session
    • Session States
    • Exceptions
    • MultipleResultsFound Exception
    • DetachedInstanceError
    • Transactions
  • 9. Testing with SQLAlchemy ORM
    • Testing with a Test Database
    • Using Mocks
  • 10. Reflection with SQLAlchemy ORM and Automap
    • Reflecting a Database with Automap
    • Reflected Relationships
    • III. Alembic
  • 11. Getting Started with Alembic
    • Creating the Migration Environment
    • Configuring the Migration Environment
  • 12. Building Migrations
    • Generating a Base Empty Migration
    • Autogenerating a Migration
    • Building a Migration Manually
  • 13. Controlling Alembic
    • Determining a Database’s Migration Level
    • Downgrading Migrations
    • Marking the Database Migration Level
    • Generating SQL
  • 14. Cookbook
    • Hybrid Attributes
    • Association Proxy
    • Integrating SQLAlchemy with Flask
    • SQLAcodegen