Python Friday #89: Constraints, Indexes and Default Values in SQLAlchemy ORM

The right index can boost the performance of your SQL query enormously while constrains help you to enforce the integrity of your data in the database. Let us look how SQLAlchemy can help us with both. I made my examples for SQLAlchemy ORM, but they work in Core as well. This post is part of …

Read more

Python Friday #88: Activate Batch Mode in Alembic to Work With Constraints in SQLite

SQLAlchemy and Alembic work on top of an abstraction layer and not directly on your database. This may lead to a situation in which a common feature in SQL is not implemented by your specific database system. Let us look what we must do before we can work with constraints in SQLite. This post is …

Read more

Python Friday #87: Handling Pre-Existing Tables With Alembic and SQLAlchemy

SQLAlchemy and Alembic are a great combination to keep your database in sync with your application as we saw in the last post. But what do you do when you already created some tables with SQLAlchemy that now contain data we cannot lose? Let us look how we can fix this without much extra work. …

Read more