db.execute
db.execute(sql, params=[])
Executes the single raw SQL statement sql on the database; optionally use params to replace the %s instances in sql (this is the recommended way of doing parameters, as it escapes them correctly for all databases).
If you want to execute a series of SQL statements instead, use db.execute_many.
Note that you should avoid using raw SQL wherever possible, as it will break the database abstraction in many cases. If you want to handle data, consider using the ORM Freezer, and remember that many operations such as creating indexes and changing primary keys? have functions in the DB layer.
If there's a common operation you'd like to see added to the DB abstraction layer in South, consider asking on the MailingList or creating a ticket.
Examples
VACUUMing a table:
db.execute("VACUUM ANALYZE core_profile")
Updating values (this sort of task should be done using the frozen ORM):
db.execute("UPDATE core_profile SET name = %s WHERE name = %s", ["andy", "andrew"])
