def my_custom_sql(self): from django.db import connection cursor = connection.cursor() cursor.execute("SELECT foo FROM bar WHERE biz = %s", [self.biz]) row = cursor.fetchone() return row