import django from django db import connection cursor connection curso

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
import django
from django.db import connection
cursor = connection.cursor()
cursor.execute("SELECT user_id, query, content_type_id, object_id, rating_id, date from result_rank")
results = cursor.fetchall()
import pickle
pickle.dump(results,open('result_ranks.dump','w'))