Django - South - Is There a way to view the SQL it runs?

Greg picture Greg · Apr 29, 2011 · Viewed 10.5k times · Source

Here's what I want to do.

Develop a Django project on a development server with a development database. Run the south migrations as necessary when I change the model.

Save the SQL from each migration, and apply those to the production server when I'm ready to deploy.

Is such a thing possible with South? (I'd also be curious what others do to get your development database changes on production when working with Django)

Answer

Lutger picture Lutger · May 5, 2011

You can at least inspect the sql generated by doing manage.py migrate --db-dry-run --verbosity=2. This will not do anything to the database and will show all the sql. I would still make a backup though, better safe than sorry.