Ejemplo: consulta sin formato en 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
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)