Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何检查django中活动游标的数量_Python_Django_Cursor - Fatal编程技术网

Python 如何检查django中活动游标的数量

Python 如何检查django中活动游标的数量,python,django,cursor,Python,Django,Cursor,我正在views.py中创建django光标 def getDetails(request, name): sql = 'select * from myTable where name=%s' % name cursor = connections['default'].cursor() cursor.execute(sql) 我没有显式地关闭游标或使用上下文管理器(带关键字)。 我想知道在django中的每个请求-响应周期之后,游标是被销毁了还是仍然存在。我使用的是

我正在views.py中创建django光标

def getDetails(request, name):
    sql = 'select * from myTable where name=%s' % name
    cursor = connections['default'].cursor()
    cursor.execute(sql)
我没有显式地关闭游标或使用上下文管理器(带关键字)。
我想知道在django中的每个请求-响应周期之后,游标是被销毁了还是仍然存在。我使用的是django 1.4

为什么要这样做,而不是使用模型层?我无法以这种方式查询数据库。数据库不是我的,我的权限有限