Answers for "django reverse raw queryset"

1

django reverse queryset

queryset = reversed(Collection.objects.filter(pk__in = li))
Posted by: Guest on July-20-2020
-1

raw query in django

from django.db import connection

sql = 'SELECT * FROM db1.a AS a
       JOIN db2.b AS b 
       ON b.some_id = a.id
       WHERE a.name = %s'
cursor = connection.cursor()
try:
      cursor.execute(sql, ['localhost'])
      row = cursor.fetchall()
except Exception as e:
      cursor.close
Posted by: Guest on June-01-2020

Python Answers by Framework

Browse Popular Code Answers by Language