0Pricing
Django Academy · Lesson

sqlmigrate and Inspecting SQL

See the raw SQL a migration will run.

See the Real SQL

Migrations are Python, but the database speaks SQL. The sqlmigrate command shows the exact SQL a migration will run.

How to Run It

Give sqlmigrate an app label and a migration number, and it prints the SQL without applying anything.

python manage.py sqlmigrate blog 0002

All lessons in this course

  1. makemigrations vs migrate
  2. Reading a Migration File
  3. Changing a Model and Re-migrating
  4. sqlmigrate and Inspecting SQL
← Back to Django Academy