“Kursor Koneksi Django” Kode Jawaban

Kursor Koneksi Django

from django.db import connection
with connection.cursor() as cursor:
  cursor.execute('TRUNCATE TABLE table_name CASCADE')
Enthusiastic Eagle

Permintaan mentah di 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
Fancy Flatworm

Jawaban yang mirip dengan “Kursor Koneksi Django”

Pertanyaan yang mirip dengan “Kursor Koneksi Django”

Lebih banyak jawaban terkait untuk “Kursor Koneksi Django” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya