Posts Tagged: orm
-
Flask-SQLAlchemy 3.1: Migrating from db.Model to Declarative Base Syntax
Migrate your Flask-SQLAlchemy models from legacy db.Model to SQLAlchemy 2.0 declarative base syntax using Mapped and mapped_column. Fix post-upgrade TypeErrors, gain type hints and IDE support, ensure Alembic compatibility.
-
Reducing Django ORM Query Time by 70% with select_related and prefetch_related
Django ORM N+1 query optimization: select_related for ForeignKey (joins), prefetch_related for ManyToMany/reverse FK (separate queries+caches). Blog example: 501→151 queries, 500ms→150ms (70% faster). django-debug-toolbar verify. Keywords: 'django select_related prefetch_related', 'django n+1 fix', 'django orm performance', 'reduce django queries', 'select_related vs prefetch_related django'.