码迷,mamicode.com
首页 > 数据库 > 详细

ORM执行原生SQL语句

时间:2019-08-10 19:07:54      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:cti   HERE   code   color   bsp   connect   nbsp   port   sele   

from django.db import connection, connections
cursor = connection.cursor()  # cursor = connections[‘default‘].cursor()
cursor.execute("""SELECT * from auth_user where id = %s""", [1])
ret = cursor.fetchone()

有点像pymysql

 

ORM执行原生SQL语句

标签:cti   HERE   code   color   bsp   connect   nbsp   port   sele   

原文地址:https://www.cnblogs.com/wt7018/p/11332481.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!