Wednesday, April 21, 2010

[Level 3] South for Django 1.2

in south project:
South automatically exposes the correct set of database API operations as south.db.db; it detects which database backend you’re using from your Django settings file. It’s usually imported using:
from south.db import db
If you’re using multiple database support (Django 1.2 and higher), there’s a corresponding south.db.dbs dictionary which contains a DatabaseOperations object (the object which has the methods defined above) for each database alias in your configuration file:
from south.db import dbs
You can tell which backend you’re talking to inside of a migration by examining db.backend_name - it will be one of postgres, mysql, sqlite3, pyodbc or oracle.

It should worth to try~

Wish this helps.

Stanley Huang