Part 3 of 7 in the Data Engineering with SQL Server path

SQLAlchemy on SQL Server booklet cover

SQLAlchemy on SQL Server

DOCX 2.5 MB Intermediate Sep 2026

This booklet guides you through integrating Python applications with SQL Server using SQLAlchemy. It starts by setting up your development environment, including Python virtual environments and required drivers. You’ll learn both the Core and ORM layers of SQLAlchemy, from defining tables and executing raw SQL to modeling complex relationships and performing migrations with Alembic.

What you'll learn

  • Setting Up Your Environment (Updated for Python 3.12.10, Windows Authentication, pyodbc)
  • SQLAlchemy Core Basics
  • The ORM Layer and Declarative Mapping
  • Querying and Filtering Data

Table of contents

  1. Setting Up Your Environment (Updated for Python 3.12.10, Windows Authentication, pyodbc)
  2. SQLAlchemy Core Basics
  3. The ORM Layer and Declarative Mapping
  4. Querying and Filtering Data
  5. Inserting, Updating, and Deleting Records
  6. Working with Relationships
  7. Migrations with Alembic
  8. Transaction Management and Concurrency
  9. Performance Tuning and Bulk Operations
  10. Testing Strategies and Fixtures
  11. Real-World Case Studies
  12. Appendix A: Connection Strings and Drivers
  13. Appendix B: Common Error Messages and Troubleshooting