PyCon DE & PyData 2025

Beyond Alembic and Django Migrations
2025-04-24 , Hassium

ORMs like Django and SQLAlchemy have become indispensable in Python development, simplifying the interaction between applications and databases. Yet, their built-in schema migration tools often fall short in projects that require advanced database features or robust CI/CD integration.

In this talk, we’ll explore how you can go beyond the limitations of your ORM’s migration tool. Using Atlas—a language-agnostic schema management tool—as a case study, we’ll demonstrate how Python developers can automate migration planning, leverage advanced database features, and seamlessly integrate database changes into modern CI/CD pipelines.


Talk Structure: "Beyond Your ORM's Migration Tool"

  1. Introduction – Why ORMs Build Migration Tools
    - ORMs like SQLAlchemy and Django ORM simplify database interactions and include migration tools (e.g., Alembic, Django Migrations) for schema changes.
    - These tools are robust for ORM-defined schemas but lack advanced features and native CI/CD integrations.

  2. Where Built-in Tools Fall Short
    - ORM migration tools focus on basic schema changes but don’t support advanced database objects like triggers, materialized views, or stored procedures.
    - Lack native integration with modern CI/CD tools, leaving teams to implement custom, often suboptimal solutions.

  3. Presenting Atlas – Bridging the Gap
    - Atlas complements ORM tools by reading their schemas (e.g., Django models, SQLAlchemy models) and enabling advanced extensions.
    - Key features:

    • Support for triggers, materialized views, and other advanced objects.
    • Native CI/CD integration for automating and validating schema changes.
  4. How Atlas Integrates with ORMs
    - Atlas reads ORM-defined schemas and enhances them with advanced features.
    - Combines ORM workflows with Atlas’s robust schema management capabilities, enabling automation and database-specific optimizations.

  5. Demo – Atlas in Action
    - Example: A Django project adds a materialized view and a trigger using Atlas.
    - Steps:

    • Use Atlas to read the ORM schema and extend it with advanced features.
    • Automate migration validation and deployment through CI/CD pipelines.
    • Outcome: Simplified and automated schema management with modern tooling.
  6. Conclusion and Q&A
    - Key Takeaways:

    • ORM migration tools like Alembic and Django Migrations are great for standard use cases but fall short for advanced workflows and CI/CD integration.
    • Atlas bridges this gap, enabling automation and advanced database features.
    • Call to Action: Try Atlas to enhance schema workflows.
    • Q&A: Open floor for questions.

Expected audience expertise: Domain:

Intermediate

Expected audience expertise: Python:

Novice

Public link to supporting material, e.g. videos, Github, etc.:

https://atlasgo.io, https://github.com/ariga/atlas

Rotem Tamir (39), father of two. Co-founder and CTO of Ariga, creator of Atlas, an open-source database schema as code tool.