1👍
The raw() method takes a raw sql query, executes it, and returns a RawQuerySet instance. You can iterate on RawQuerySet like normal QuerySet and get objects.
sql = "select * from api_student"
student_qs = Student.objects.raw(sql)
for obj in student_qs:
print(obj.pk, obj.firstname, obj.surname)
Source:stackexchange.com