Version 13 (modified by andrew, 6 years ago) (diff)


Database API

South comes with a simplistic database abstraction layer that sits above DBAPI, which provides a common connection cursor and sql-slinging interface, and below Django's database API, which deals with high-level data.

south.db (as this layer is known) allows you to create, modify and delete tables, columns and other database items (like indexes) in a database-agnostic way, so you can just reuse your migrations if you switch database rather than having to rewrite all the SQL.

All operations are methods on the south.db.db object; the usual import to have is

from south.db import db

This line will have automatically been added to your migrations if you created them using startmigration.

For detailed documentation on each API method, there are links to them from the Documentation page.


Please note that we're still adding new methods to the database API. If one you want is still missing and does not have a ticket, please add one.