As I'm getting output in SQL when I try in python its showing as ProgrammingError :No results. Previous SQL was not a query
. even I have tried with fetchone()
and fetchvalue()
here what I tried
@api_view(['GET'])
def getUtilizationSummary(request, UserId):
if request.method == 'GET':
cursor = connection.cursor()
cursor.execute('EXEC [dbo].[Usp_Leftsidepanel] @UserId=%s', (UserId,))
result_set = cursor.fetchall()
print('getUtilizationSummary', result_set[0])
data = []
for row in result_set:
data.append({
'Utility':row[0],
'Productivity':row[1],
'BreakMeeting':row[2]
})
return Response(data)